PHP - Previous and Next Links - Building the Previous and Next Links
(Page 4 of 5 )
Ok, down to the part you've been looking forward to. Let's actually make those Previous and Next links.
First of all, let's think about it for a second. Say you have a variable named $start (we do), so you know the first row someone is looking at and you know how many rows total there are in your result (we will) then you can easily determine if Previous or Next links are needed.
If $start is higher than 0 (zero), then we need to display a Previous Link so that people can see records before $start. If the number of rows in your result is greater than $start plus the number of rows we are displaying (in our examples 10) we need to display a Next link. This is the basis of our code logic. If you got this, writing the code is easy.