开发者

PHP and mysql pagination, next/prev links

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 di开发者_如何学JAVAplay, 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.


You want something like this:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜