CodeIgniter Forums
Session for pagination - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Session for pagination (/showthread.php?tid=52327)



Session for pagination - El Forum - 06-06-2012

[eluser]veledrom[/eluser]
Hi,

I have a massive table and want to use for pagination purposes. When I search something, I get 5000 records and it takes about 5 seconds. Everytime I navigate through I have to send another query to database with limit and offset. If I store results in a database session once, can I re-use that session for pagination purposes? If so, how do I do it? Or is there any better way?

Thanks


Session for pagination - El Forum - 06-06-2012

[eluser]CroNiX[/eluser]
You can also look into query caching. It's cheap and very effective. Just remember to delete the cache for items when the data gets updated.

And, CI has a built in pagination class, have you looked into that?


Session for pagination - El Forum - 06-07-2012

[eluser]veledrom[/eluser]
I tried CI's query caching but it is a bit problematic when it comes to deleting cached query file in cache folder. I'll use phil sturgeon's partial caching library instead.

For the CI Pagination, I cannot number returned rows in table, like 1,2,3,4..... E.g. Only NAME, SURNAME fields come from database.

Thanks