How to limit the resultset when using pagination? |
[eluser]kbkb[/eluser]
Hi i want to use pagination. I read the userguide http://ellislab.com/codeigniter/user-gui...ation.html here. But i dont know how to limit the resultset. Is there some kind of command which i should pass to the database-class that the right part of the resultset is display? It always display me the whole 100s of entries and don't show any pagination-links. greetings
[eluser]Dam1an[/eluser]
You would need to use a limit clause in your model which would define how many to retreive at once and the offset The offset is the last URI segment and the limit is how many you want per page
[eluser]Thorpe Obazee[/eluser]
You can probably look at this: Pagination with CodeIgniter It actually works just like pagination classes on the web but easier since the offset is often seen on the URL.
[eluser]jegbagus[/eluser]
kbkb, add LIMIT query at your sql. example : Code: select * from yourtable limit 10,5 best regard
[eluser]kbkb[/eluser]
Thank you guys. I had think, that the pagination-class instantly take access to the db-class and limit the result set there. Don't know, that i have made something by hand But its a really nice solution, very copy-and-pastable |
Welcome Guest, Not a member yet? Register Sign In |