i was wondering if anyone as a good idea or solution to use pagination without counting all records before splitting results
i mean when paginating with default CI library we must set total number of records, and this will be too huge for high amount of records don’t you think?
what if i have more then 500’000 records to be paginated?
开发者_StackOverflow社区so my idea was trying paginating using ranges somenthing like :
page 1 => query LIMIT 0,10
page 2 => query LIMIT 10,20
but i found many problems:
1) i anyway need to count all records to retrieve page numbers 2) how to save ranges ([1,10] [10,20] ... etc)?
thanks to anyone could help me
If you use your solution where you use a LIMIT
to get each page, then use the FOUND_ROWS().
It will give you the amount of rows totally excluding the limit. This way you don't need two queries where the first retrieves the specific range and the other one retrieves the total rows.
精彩评论