I had this problem once, took me ages to figure it out and Iยดm pretty sure there are better ways to handle this.
So you want to display 50 names per page, the way I do this is by counting, fetch all the names and use a while loop, if you're on the first page you will display 1-50.
$x = $_GET['page'];
$lastdisplay = $x * 50;
$firstdisplay = $end - 49;
$buffer = 0;
$sql = mysql_query("Your query");
while ( $foo = mysql_fetch_array( $sql) )
{
$buffer++;
if ( $buffer >= $start && $buffer <= $end )
{
echo $foo[$buffer]; // Display data
}
}
Not sure this will work 100%, but I hope you get the idea, there might become a problem with server bandwidth if you have to many users.
Something I just thought of, if you have all your user with an id, you could use an array, select the users with id 1-50 for page 1, 51 - 100 if page 2 etc. (Might just use this myself ๐
About sorting, the first thing that comes to mind is using a switch with different queries inside each case.
If you want me to explain something better just let me know and I'll try ๐
If there's someone who has better ideas then me please share ๐ Always fun to learn new things.