Welcome Guest, Not a member yet? Register   Sign In
How to limit the resultset when using pagination?
#1

[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
#2

[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
#3

[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.
#4

[eluser]jegbagus[/eluser]
kbkb, add LIMIT query at your sql.
example :
Code:
select * from yourtable limit 10,5
10 will be the number generated by CI pagination library, and 5 number of row every page.

best regard
#5

[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 Smile But its a really nice solution, very copy-and-pastable Big Grin




Theme © iAndrew 2016 - Forum software by © MyBB