CodeIgniter Forums
Pagination Trouble - 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: Pagination Trouble (/showthread.php?tid=7571)



Pagination Trouble - El Forum - 04-15-2008

[eluser]JasonS[/eluser]
I don't understand how pagination works.

I get that the class generates the numbers to toggle between the pages but how do I get the specific results for each page?

What should my db query look like?


Pagination Trouble - El Forum - 04-15-2008

[eluser]taewoo[/eluser]
What i do is make two queries..

1. Get 5 results associated with search, say , on page 2
Code:
"select * from table where product_type = 'blah' limit 5, 2"


2. Get total associate with search...
Code:
"select count(*) from table product_type = 'blah'"

This is how I do it. I know #2 isn't very efficient. Any one else have any suggestion?


Pagination Trouble - El Forum - 04-15-2008

[eluser]taewoo[/eluser]
http://ellislab.com/forums/viewthread/76692/


Pagination Trouble - El Forum - 04-16-2008

[eluser]BD-CI-Programmer[/eluser]
I am not understand pagination class and how its work. But i have a good solution. Please go to http://www.phpclasses.org and find a pagination class. Now Integrate that class on your libraries.