Jump to content

[SOLVED] Increment +10 -10 not working for pagination


Guest elthomo

Recommended Posts

Guest elthomo

Ok well my code on on the plus just sets the value to 10 rather than adding 10 to the value $startrow and the minus just sets the value to -10 rather than taking away 10 from the value start row. Any Ideas chaps??

 

echo '<a href="'.$_SERVER['PHP_SELF'].'?startrow='.($startrow +10).'&zoek='.($zoek).'&searchcriteria='.($searchcriteria).'">Next</a>';
echo '<a href="'.$_SERVER['PHP_SELF'].'?startrow='.($startrow -10).'&zoek='.($zoek).'&searchcriteria='.($searchcriteria).'">Previous</a>';

Link to comment
Share on other sites

echo '<a href="'.$_SERVER['PHP_SELF'].'?startrow='.($startrow +10).'&zoek='.($zoek).'&searchcriteria='.($searchcriteria).'">Next</a>';
if($startrow <10 )
{
echo '<a href="'.$_SERVER['PHP_SELF'].'?startrow=0&zoek='.($zoek).'&searchcriteria='.($searchcriteria).'">Previous</a>';
}else
{

echo '<a href="'.$_SERVER['PHP_SELF'].'?startrow='.($startrow -10).'&zoek='.($zoek).'&searchcriteria='.($searchcriteria).'">Previous</a>';
}

Link to comment
Share on other sites

Guest elthomo

Thanks for the quick reply but the problem is with the +10 -10 actually setting the value to 10 or -10 rather than adding or subtracting 10. So the webadress looks like http://www.myurl.com/search.php?startrow=-10 when the previous value was 10. (so it should have been 0) and clicking next always looks like  http://www.myurl.com/search.php?startrow= 10 not 20,30,40 and so on.

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.