Okay, I think the following would work
Code:
SELECT * FROM ".$prefix."_users WHERE played > 0 AND id != $playerid ORDER BY points LIMIT $rank-50, 100
Now to explain it. You only want those who have played (so hence the played > 0), and you don't want to include the existing player, so that explains the id != $playerid.
Then I ordered by points, as that was the comparison used for rank, then I used LIMIT's ability to indicate a starting position, which would be the current person's rank minus 50 (may need to be 51, so watch your results) and told it to grab 100 records, which should be 49/50 higher and 50/51 lower ranked individuals (against watch your records and change the $rank-50 accordingly).
Query in PHP syntax
PHP Code:
$sql = mysql_query("SELECT * FROM ".$prefix."_users WHERE played > 0 AND id != $playerid ORDER BY points LIMIT ".($rank-50).", 100") or die(mysql_error());
Bookmarks