Forum Moderators: coopster
I know that I can use some version of "SELECT SUM" to gather the info, but I can't figure out how to convert it to a variable.
Any help?
Here's what I have so far:
<?php
$scoreTotQuery = "SELECT SUM(score)
FROM
pc_complete";
$scoreTotResult = mysql_query($scoreTotQuery);
?>
I want to be able to retrieve the total of all scores that have been recorded, so that I can display the average score.
$sRow = mysql_fetch_array(mysql_query($scoreTotQuery));
$total = $sRow['total_score'];
echo $total, ' is the score';
?>
by the way I will strongly recommend you to study any simple php-mysql tutorial and do not jump to direct solutions.