MySQL v3.x
PHP v4.x
I have a scoring table with almost 15,000 rows. Ranking a particular person is required.
I currently have this script to calculate the rank:
$myScore = 233292;
$result = mysql_query("SELECT COUNT(*) as count FROM tbl WHERE score>$myScore");
$row = mysql_fetch_array($result, MYSQL_ASSOC);
echo "You rank $row[count]."; // You rank 123422.
which… according to my web host, is causing excessive server load.
I’m wondering if there’s any other way to optimize it?
thanks!