how does one add the total amount of search results above a page?
this scripts for example does everything I need, but to make sure customers understand that there're more than 20 links spread over different pages, I want to add the total to the script
<?php
mysql_connect (localhost, ******, ******);
mysql_select_db (*******);
$startdate='2003-01-01';
$enddate='2003-01-31';
//anatal records per pagina
$limit=20;
$numresults=mysql_query("SELECT * FROM opleiding WHERE start >='$startdate' AND start <='$enddate'");
$numrows=mysql_num_rows($numresults);
//bypass offset
if (empty($offset)) {
$offset=0;
}
$result=mysql_query("SELECT * FROM opleiding WHERE start >='$startdate' AND start <='$enddate' ORDER by start limit $offset,$limit");
while ($row = mysql_fetch_array($result)) {
print ("<tr>");
print ("<td width=55%>");
print $row["cursus"];
print (" ");
print ("</td>");
print ("<td width=15%>");
list($year, $month, $day) = explode("-", $row["start"]);
echo $day;
print ("/");
echo $month;
print ("/");
echo $year;
print (" ");
print ("</td>");
print ("<td width=15% align=center>");
print ("<a href=\"http://www.syntra-ab.be/detail.php?id=$row[id]\">");
print ("details");
print ("</a>");
print ("</td>");
print ("<td width=15% align=center>");
print ("<a href=\"http://www.syntra-ab.be/inhoud.php?id=$row[id]\">");
print ("inhoud/doelgroep");
print ("</a>");
print ("</td>");
}
print ("</table>");
print ("<br>");
// geen vorige pagina op pagina 1
if ($offset >= 1) {
$prevoffset = $offset - 20;
print "<a href=\"start.php?offset=$prevoffset\">VORIGE</a> - \n";
}
$pages=intval($numrows/$limit);
if ($numrows%$limit) {
$pages++;
}
// geen link op huidige pagina
for ($i = 1; $i <= $pages; $i++) {
$newoffset = $limit*($i-1);
if ($newoffset == $offset) {
print "pag. $i - \n";
} else {
print "<a href=\"start.php?offset=$newoffset\">pag. $i</a> -\n";
}
}
// geen volgende pagina op laatste pagina
if (! ( ($offset/$limit) == ($pages - 1) ) && ($pages != 1) ) {
$newoffset = $offset+$limit;
print "<a href=\"start.php?offset=$newoffset\"> VOLGENDE</a><p>\n";
}
?>