How do I sum data from a certain colum in a mysql database.
like if my data is
choice | total
opt a | 5
opt b | 3
opt c | 7
How would I add up those totals? I ended up trying this but it didn't work.
$query = mysql_query("SELECT * FROM test")
while ($row = mysql_fetch_array($query)) {
$a = array($row['total']);
echo array_sum($a);
}
(P.S. I'd like to do this without omitting the "choice" column in the table select)