user list

Need help with an engine or coding not on the list? Need help with a game or the website and forums here? Direct all questions here.
Post Reply
stefans
Posts: 48
Joined: Wed Sep 14, 2011 7:14 pm

user list

Post by stefans »

Hello all,
So i want to make a user list.. (i know how to make this)
but i want it to be more pages, so 20 users to page, how exactly do i do that? because i've never done that before =p

Thanks for the help =D
Current project: http://www.mmtycoon.eu
Xaleph
Posts: 897
Joined: Mon Feb 07, 2011 2:55 am

Re: user list

Post by Xaleph »

It`s called pagination. The idea is that if the limit is 20, you only query 1 to 20 for the first page, if you go to the next page, you pass a parameter ( the pagination number ) that measures the offset.

So pagination number 1 is: 1 * 20 for the first, 1 * 20 + 20. 20 - 40
So pagination number 2 is: 2 * 20 for the first, 2 * 20 + 20. 40 - 60
So pagination number 3 is: 3 * 20 for the first, 3 * 20 + 20. 60 - 80

You can limit your query`s using the LIMIT keyword. Like "SELECT username, score FROM users LIMIT 20, $offset".
stefans
Posts: 48
Joined: Wed Sep 14, 2011 7:14 pm

Re: user list

Post by stefans »

Ok thank you =)
Post Reply

Return to “Advanced Help and Support”