$query = mysql_query("SELECT SUM(rating) FROM `ratings` WHERE `fileid` = '" . $id . "'"); $rate = mysql_fetch_assoc($query); echo $rate['rating']; PHP: I'm trying to get the number that query returns, I ran the query in phpmyadmin and it returned a number, but when I try and get it using the code above it doesn't show anything, help appreciated