hi
i'm trying to display results in a tabular paged format with 20 rows displaying on each page. the first 20 rows display fine on the first page but when i click on page2 or the next link, there is nothing on the page. here is the code i have:
} else if ($select == "Age group") {
$limit = 20;
$page = $_GET["page"];
if ($page == "") {
$page = 1;
}
$query = "SELECT agegroup, firstname, surname, username FROM Fencers WHERE agegroup='$edit' and province='$prov' ORDER BY surname";
$results = mysql_query($query);
$num_rows = mysql_num_rows($results);
$numpages = ceil($num_rows/$limit);
$query = "SELECT agegroup, firstname, surname, username FROM Fencers WHERE agegroup='$edit' and province='$prov' ORDER BY surname LIMIT " . ($page-1)*$limit . ",$limit";
$results = mysql_query($query);
if ($num_rows == 1) {
print "<p>Your search results for <b>$edit has exactly $num_rows match</b></p>";
} else {
print "<p>Your search results for <b>$edit has $num_rows matches</b></p>";
}
print "<table width='60%' cellspacing='2' cellpadding='3' border='0'>\n";
print "<tr><td width='20%'><b>Age Group</b></td><td width='20%'><b>First Name</b></td><td width='20%'><b>Surname</b></td><td width='20%'><b>Username</b></td><td width='20%'> </td></tr>\n";
while ($get_info = mysql_fetch_object($results)){
print "<tr>\n";
foreach ($get_info as $edit)
print "<td width='25%'>$edit</td>\n";
print "<td width='25%'><a href='provupdate.php?value=$edit'>Edit</a></td>";
print "</tr>\n";
}
print "</table>\n<br>";
$nav = "";
if ($page > 1) {
$nav .= "<a href=\"eg.php?page=" . ($page - 1) . "\"><< Prev</a>";
}
for ($i = 1; $i <= $numpages; $i++) {
if ($i == $page) {
$nav .= "<b>$i </b>";
} else {
$nav .= "<a href=\"eg.php?page=" . $i . "\">$i </a>";
}
}
if ($page < $numpages) {
$nav .= "<a href=\"eg.php?page=" . ($page + 1) . "\">Next >></a>";
}
echo "<br><br>" . $nav;
}
why are the rest of the results not showing in the other pages?
thanks