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>';

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>';
}

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.