if (!$username = $row['username']) $username = "No such user!"; if (!$points = $row['games_points']) $points = 0; $total = 1; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $total++; if ($row["user_id"] == $id) { $rank = $total; } } if ($rank) $rank = $rank . " of " . $total;