$player = $db->fetch_row($db->query('select userid, username, level from users order by level desc limit 5'));
That'll select USERID, USERNAME, AND USERS LEVEL from the users table, then order the results by level DESCENDING, then limits to 5 results.
Output would be ".$player['userid']."