I have the following tableCountry
country clicks
------- ------
0 222
66 34
175 1000
45 650
And I use the following MYSQL statement to get the ranking of any of the country based on the clicks column (just one result)
SELECT COUNT(*) rank
FROM countryTable a
JOIN countryTable b
ON a.clicks <= b.clicks
WHERE a.country = 45
The above will return '2'. Then in my php code I try to access the rank value with
$row = mysql_fetch_array($result) or die(mysql_error());
echo $row['rank'];
But this doesn't return any result if the country is the number one. i.e a.country = 175