Now that I have the totals in a separate column, I would like to show a competition ranking. If I select the relevant columns, sort them on 'totals' in descending order, and show this in a table, the list shows the following: Rank Name Totals 1 User A 200 2 User B 150 3 User C 150 4 User D 100 Is it possible to assign ranks like you would do in a competition (A:1, B:2, C:2, D:4)? Below is the code I use right now: [code]<? function showRanglijst(){ global $database; $query = "SELECT username, name, totaal FROM punten ORDER BY totaal DESC LIMIT 0, 10"; $result = mysql_query($query) or die(mysql_error()); $num_rows = mysql_numrows($result); if(!$result || ($num_rows < 0)){ echo "Error displaying info"; return; } if($num_rows == 0){ echo "Database table empty"; return; } echo "<table align=\"left\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\" width=\"380\">\n"; echo "<tr><td><b>Nr.</b></td><td><b>Naam</b></td><td><b>Punten</b></td></tr>\n"; for($i=0; $i<$num_rows; $i++){ $username = mysql_result($result,$i,"username"); $name = mysql_result($result,$i,"name"); $totaal = mysql_result($result,$i,"totaal"); $nummer = $i+1; echo "<tr><td>$nummer</td><td><a href=\"userinfo.php?user=$username\" title=\"$username\">$name</a></td><td>$totaal</td></tr>\n"; } echo "</table><br>\n"; } ?>[/code]