You could simply execute a second query where score > $score and return the number of rows in the result + 1.
For instance: $return = mysql_query("select ID, Name, Score, COUNT(Name) as total from members where ID = '$ID'"); $row = mysql_fetch_assoc($return); extract ($row); $return = mysql_query("select * from members where Score > '$Score'"); $rank = mysql_num_rows($return) + 1; echo "$Name is ranked $rank of $total"; Fred Andrew Brampton <[EMAIL PROTECTED]> wrote in message 00c101c18029$8b2ed040$2528260a@STUDENT5830">news:00c101c18029$8b2ed040$2528260a@STUDENT5830... Hi, This isn't a php question, more of a SQL question, but I don't know any where better to send it, and I guess its trival enough for someone here to answer. Anyway, I have a list of members each with a score field. How can I say that Member 3 is ranked 10 out of 100 members for example. Here is the layout of the members table: ID, Name, Score I can get the total count of members in the table, but I don't know how to determine what rank they are, unless I return all the rows in the table (sorted), and cycle through them until I find the member I want, counting how many people are above him... This method would work, but would be slow (and wastful), is there a better way to determine his position with a SQL Query? Thanks in advance Andrew P.S If it matters I'm using MySQL & PHP 4.0.6 on WinXP under Apache 1.3.22 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]