I know how to create pagination with php if I have 25 results with 5 results each page, but what about if the limit number can change in the hundreds everyday? How can I write something where the php itself will create more pages if the 开发者_Go百科row count itself changes?
usually pagination is made in two steps:
- query to count the number of records
- unsig the prevoius query, create the query using LIMIT to retrieve the current page
So i don't see the problem o_O, if tomorrow the number of elements change then the first query would return a different result.. and you wont have problems with the pagination
Later, if you want to improve performance you could set a cache system for the count
query.
Hope this helps
精彩评论