1. SELECT COUNT(`uid`) as aa FROM `cdb_members` WHERE `extcredits2`+`extcredits3` > (SELECT `extcredits2`+`extcredits3` FROM `cdb_members` WHERE `username` = '$name'

 

 

 
  1. $sql03="SELECT COUNT(`uid`) as aa FROM `cdb_members` WHERE `extcredits2`+`extcredits3` > (SELECT `extcredits2`+`extcredits3` FROM `cdb_members` WHERE `username` = '$name')"
  2. $query03=mysql_query($sql03,$conn); 
  3. $row03=mysql_fetch_array($query03); 
  4. $ranking=$row[aa]+1; 

 

记得加1