<? $result = mysql_query("SELECT * FROM mclinkscounter ORDER BY clic DESC"); $rank = 1; echo "<table border=\"0\"><tr><td>Game Name</td><td>Description</td><td>Hits</td><td>Rank</td></tr>"; while($row = mysql_fetch_array($result)){ echo "<tr><td>" . $row['nom'] . "</td><td>" . $row['cat'] . "</td><td>" . $row['clic'] . "</td><td>" . $rank . "</td></tr>"; $rank++; } echo "</table>"; ?> This results in [a href=\"http://www.game-kings.com/php/test.php\" target=\"_blank\"]http://www.game-kings.com/php/test.php[/a] Now, the first 3 values (nom, cat & clic) are taken from the database, the 'rank' value isn't, but I'm looking for something that updates the rank row in my database to the rank this code produces for that game. Example: Bow man has rank 1 on this page, so I need something that sets rank = 1 for bow man, goldminer has rank 2 on this page, so I need something that sets rank = 2 for gold miner... etc. I know how I can let the code run automatically, I just don't know the code yet :p