My PHP/MYSQL Rank code used to work but is now not working. The first user gets a rank of one but all other users get a rank of 0. Please help. Code below. Thanks in advance.
$result = mysql_query("SELECT username as User, sum(abs(pick=gwin)) as 'Correct Picks' FROM picks group by username order by 'Correct Picks' desc")
or die("Invalid query: " . mysql_error());
$rank=0;
$rankf=0;
while ($row = mysql_fetch_assoc($result)){
$rank++;
$usern=$row["User"];
if ($username==$usern){
$rankf=$rank;
}
}
print " $rankf \n";