Forum Moderators: coopster
$count_result = mysql_query("SELECT COUNT(*) FROM $table");
$count_row = mysql_fetch_array($count_result);
//fetch the total number of rows in the table
$count = $count_row["COUNT(*)"];
//we will use this information to build our navigation list
echo (($page>1)?"<a href='".build_url("sql.php", "page", $page-1)."'><font size='2px'>previous</font></a>":"previous")." | ";
for($i=1; $i<=($count/$records_per_page)+1; $i++){
if($i!=$page)
echo "<a href='".build_url("sql.php", "page", $i)."'>$i</a>";
else
echo $i;
//output a little symbol (|) to seperate the links
//but not for the last link
if($i<$count/$records_per_page)
echo " | ";
}
echo " | ".(($page<$count/$records_per_page)?"<a href='".build_url("sql.php", "page", $page+1)."'><font size='2px'>next page</font></a>":"next");