hi everyone, 

I' ve a table named as 'highscores', inserting result scores of a game and 
players name(each player can only play once)  what I want to do is to get the 
"current rank" of a player over a listing of all rows ordered by scores desc. 


id -name - score 
1 - userA - 8
2 - userB - 3
3 - userC - 10
4 - userD - 2
5 - userE - 7


here is how I figured out this thing:
 

$sql=mysql_query(SELECT userD  FROM highscores ORDER BY score DESC);
$i=1;
while($scorelist=mysql_fetch_array($sql))
{
    if($scorelist[name]=='userD')
           echo "your rank is:  $i ";
$i++;
}


how can I get a specific row's  "formatted no"  through all affected rows? Is 
there a MySQL command doing this job that i am unaware of? 

thx  in adv. 


Reply via email to