http://www.phpbuilder.com/board/showthread.php?s=&threadid=10274619
I'm trying to paginate the code display in that link. it paginates fine. My problem is getting the "next" and "previous" links to only appear when there are actual results to display. I don't want them showing up when there aren't any results, and I don't want them showing up when there won't be more results to show. I just want a simple way to paginate my database queries so that if 27 items show up, and there is 10 items per page, only 3 pages are used to display that information, and the links work and do what their supposed to.
this is the code I'm trying to work with to make it do that:
<?
//now this is the forward link..
if ($total_results>0\25){
echo '<a href="testie.php?startrow='.($startrow+5).'&search='.$search.'">Next</a>';
} elseif ($total_results<=4){
print "done";
}
?>
<?
//now this is the backward link..
if ($total_results<=25){
echo '<a href="testie.php?startrow='.($startrow-5).'&search='.$search.'">Back</a>';
}
?>
I'm not really experienced at this, and I'm just trying to see how someone with experience would use this code to get the results I'm after. What they could add to it, or take away, etc.
I've been working on this for hours, so I apoligize if I sound frustrated. Some people have led me in the right direction, but no one has actually just told me what to do...and at this point, I'm pretty confused.