0
votes

EDIT

To clarify I dont need to know how to do pagination, I guess Im trying to figure out how to display the next/previous link if all rows are returned. So if I want to display 20 rows per page I do a limit with 21. So I know now that there is another row to diplay, then show the next link. Yet still display 20 rows on the current page and still start off at the 20th row in the next page. The current issue is if I had 0-19 on the first page, the next page would show 21-40, so its missing 20. I guess I just need to minus 1 on top of the offset to get the correct starting point.

1

1 Answers

2
votes

You want something like this:

 $lowerLimit = ($pageNumber - 1) * $resultsPerPage;
 $sql = "SELECT * FROM tbl1 LIMIT $lowerLimit, $resultsPerPage";