Single Result From SUM With MySQLi

It’s best if you used an alias for your SUM:

SELECT SUM(`field`) as `sum` FROM `table_name`

And then, you’ll be able to fetch the result normally by accessing the first result row’s $row['sum'].

Leave a Comment