Looked all over. Can't find an answer. PHP docs not clear (to me).
I'm doing a simple MySQL sum through mysqli->query. How can I get the result with MySQLi like mysql_result?
mysqli->query
mysql_result
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'].
$row['sum']
1.4m articles
1.4m replys
5 comments
57.0k users