So I am trying to find the amount of kills in the league database during the last 10 matches with a character. Both are set up correctly to work and without the SUM and LIMIT & ORDER it works perfectly. However, when attempting to find the SUM of the last 10 rows added I seem to be hitting a stumbling block. After trying a few suggested things from different sites I have come up with something which seems as though it should work although it brings up the error:
Warning: mysql_result() expects parameter 1 to be resource, boolean given in "filepath" on the following line:
$kills = mysql_result(mysql_query("
SELECT SUM(kills)
FROM (SELECT `kills`
FROM league
WHERE `gameType`='N' AND `champion`='$champion'
ORDER BY `matchID` DESC
LIMIT 10)"), 0);
The error comes when I try to echo out $kills
Any help would be greatly appreciated.