Now code looks like this... No links(page navigaton links) working...
i think(not sure) problem @ line no 55, 66 & 77...(query part of URL).
<?php
//CONNECTION TO DATABASE!
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="accounts"; // Database name
$tbl_name="login"; // Table name
$tbl1_name="details"; // Table1 name
// Connect to server & select databse.
$con=mysql_connect("$host","$username","$password");
mysql_select_db("$db_name",$con);
$show_all=$_POST['rg01']; // Show All
//**EDIT TO YOUR TABLE NAME, ECT.
$t = mysql_query(" SELECT username FROM $tbl1_name WHERE sex = '$show_all' ");
if(!$t) die(mysql_error());
$a = mysql_fetch_object($t);
$total_items = mysql_num_rows($t);
$limit = 3; //default
$page = 1; //default
//$sex = $show_all;
//calcuate total pages
$total_pages = ceil($total_items / $limit);
$set_limit = $page * $limit - ($limit);
//query: **EDIT TO YOUR TABLE NAME, ECT.
$q = mysql_query("SELECT username FROM $tbl1_name WHERE sex = '$show_all' LIMIT $set_limit, $limit");
if(!$q) die(mysql_error());
$err = mysql_num_rows($q);
if($err == 0) die("No matches met your criteria.");
echo "<br>";
//show data matching query:
while($code = mysql_fetch_object($q)) {
echo("item: ".$code->username."<BR>");
}
$sex = urlencode($show_all); //makes browser friendly
//echo $show_all;
//echo $sex;
echo "<br>";
//prev. page: **EDIT LINK PATH**
$prev_page = $page - 1;
if($prev_page >= 1) {
echo("<b><<</b> <a href=http://localhost/wamp/www/28_09_pm_new/new.php?sex=$sex&limit=$limit&page=$prev_page><b>Prev.</b></a>");
}
//Display middle pages: **EDIT LINK PATH**
for($a = 1; $a <= $total_pages; $a++)
{
if($a == $page)
{
echo("<b> $a</b> | "); //no link
}
else
{
echo(" <a href=http://localhost/wamp/www/28_09_pm_new/new.php?sex=$sex&limit=$limit&page=$a> $a </a> | ");
}
}
//next page: **EDIT THIS LINK PATH**
if($page!=$total_pages)
{
$next_page = $page + 1;
if($next_page <= $total_pages)
{
echo("<a href=http://localhost/wamp/www/28_09_pm_new/new.php?sex=$sex&limit=$limit&page=$next_page><b>Next</b></a> > >");
}
}
//all done
?>