i am trying to get my pagination to work but im having a problem, the "switching between" pagen wont work at all, and the results is not really working to well. Can someone help to get it working cause i cant for my life get it to work and i have tried so much :/
<?
if (!(isset($pagenum)))
{
$pagenum = 1;
}
$currentpage = 20;
$data_p = mysql_query("SELECT * FROM dogs LIMIT $currentpage") or die(mysql_error());
//This is where you display your query results
while($info = mysql_fetch_array( $data_p ))
{
$id=$info['id'];
echo '<a href="/index.php?dogs='. $id .'">
<img src="/thumbs/'. $id .'.jpg" width="100" height="100" alt="" />
</a>';
echo "<br>";
}
echo "<p>";
// This shows the user what page they are on, and the total number of pages
echo " --Page $pagenum of $last-- <p>";
// First we check if we are on page one. If we are then we don't need a link to the previous page or the first page so we do nothing. If we aren't then we generate links to the first page, and to the previous page.
if ($pagenum == 1)
{
}
else
{
echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=1'> <<-First</a> ";
echo " ";
$previous = $pagenum-1;
echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$previous'> <-Previous</a> ";
}
//just a spacer
echo " ---- ";
//This does the same as above, only checking if we are on the last page, and then generating the Next and Last links
if ($pagenum == $last)
{
}
else {
$next = $pagenum+1;
echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$next'>Next -></a> ";
echo " ";
echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$last'>Last ->></a> ";
}
?>