Welcome Guest, Not a member yet? Register   Sign In
Pagination over resultset
#2

[eluser]Colin Williams[/eluser]
[quote author="fiktionvt" date="1258505742"]I think my first post was unclear. I am trying to use pagination but instead of paginating an entire table in my database, I want to paginate over a custom query resultset. So for example if my query was

Code:
SELECT * first_name, last_name, userID FROM users;

I would like to paginate over that result set on my view. I have read a lot about the pagination class and have tried all day to get it to work but I am just not understanding. Can someone show me some sample code on how this might be achieved? Thanks[/quote]

Your query needs a limit and offset. Offset will initially be 0, and $perpage should always be the same. These will be the same values you use for your pagination config.

Code:
SELECT * first_name, last_name, userID FROM users LIMIT $offset, $perpage;


Messages In This Thread
Pagination over resultset - by El Forum - 11-17-2009, 12:55 PM
Pagination over resultset - by El Forum - 11-17-2009, 02:14 PM
Pagination over resultset - by El Forum - 01-13-2010, 03:10 PM
Pagination over resultset - by El Forum - 01-13-2010, 03:18 PM
Pagination over resultset - by El Forum - 01-13-2010, 03:33 PM
Pagination over resultset - by El Forum - 01-13-2010, 03:39 PM
Pagination over resultset - by El Forum - 01-15-2010, 03:10 PM
Pagination over resultset - by El Forum - 01-15-2010, 03:17 PM



Theme © iAndrew 2016 - Forum software by © MyBB