Hitman
02-09-2009, 05:09 PM
Hey, I think this would be simple to do but I've no idea how to do it.
I've got a kind of leaderboard, where the top 10 users (1st to 10th - descending) are listed with their, "points". Obviously the user with the most "points" is first. I've managed to do this myself...
$get = mysql_query("SELECT * FROM `users` ORDER BY `amount` DESC LIMIT 0 , 10");
while($each = mysql_fetch_array($get)) {
echo "<tr>
<td>*RANK*</td>
<td>".$each['username']."</td>
<td>".$each['amount']."</td>
</tr>";
}
And it puts them into a nice table which is displayed. The problem is, see where the *RANK* is? That will say 1st, 2nd, etc. But how do I do it? If I put "1" in there, they all get number 1. So what would I put? I'm not wanting to create an extra table or row for their rank btw...
Thanks.
I've got a kind of leaderboard, where the top 10 users (1st to 10th - descending) are listed with their, "points". Obviously the user with the most "points" is first. I've managed to do this myself...
$get = mysql_query("SELECT * FROM `users` ORDER BY `amount` DESC LIMIT 0 , 10");
while($each = mysql_fetch_array($get)) {
echo "<tr>
<td>*RANK*</td>
<td>".$each['username']."</td>
<td>".$each['amount']."</td>
</tr>";
}
And it puts them into a nice table which is displayed. The problem is, see where the *RANK* is? That will say 1st, 2nd, etc. But how do I do it? If I put "1" in there, they all get number 1. So what would I put? I'm not wanting to create an extra table or row for their rank btw...
Thanks.