Jump to content

need help with Pagination problem


izlik

Recommended Posts

hello, this code http://nopaste.php-quake.net/9687  it's a tag system and on the bottom of the page there is a "next" to shift page if there is more then 30 images in total for the tag a user pressed. if i however have the tag "tags.php?=games" and press "next" it becomes "tags.php?pagenum=2" and everyting becomes messed up, do anyone know why? and could help me some this problem? :/ i cant get my head around it.

Link to comment
Share on other sites

You need to be passing the tag variable in the URL in all of your pagiation links - each time the page loads, it searches the database dependant on that variable, so it is always needed. You need to make your links like:

 

echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=1&tag={$_GET['tag']}'> <<-First</a> ";

 

You'll need to change all the other links to also pass tag in the URL.

Link to comment
Share on other sites

Hey again.

 

i added in what you said into the code so it looks like bellow, but when i now press "next" it will reload the page on page 1 al lthe time and not go to 2 or 3 "/tags.php?pagenum=2&tag=" <-- resault i get in the browser, no tag :/

 

<?	
    echo " --Page $pagenum of $last-- <p>";
   
    if ($pagenum == 1)
{
}
else
{
echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=1&tag={$_GET['tag']}'> <<-First</a> ";
echo " ";
$previous = $pagenum-1;
echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$previous&tag={$_GET['tag']}'> <-Previous</a> ";
}

//just a spacer
echo " ---- ";

if ($pagenum == $last)
{
}
else {
$next = $pagenum+1;
echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$next&tag={$_GET['tag']}'>Next -></a> ";
echo " ";
echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$last&tag={$_GET['tag']}'>Last ->></a> ";
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.