I am attempting to perform the following query:
SELECT SUM(cash) AS total_cash FROM users
The query should give me back a SUM()
of the total cash which I've paid out to users in the form of a field named total_cash
.
My HTML/PHP is as follows:
<p class="cash_count">
$<?
$total_cash = $db->GetNumRows($db->Query("SELECT SUM(cash) AS total_cash FROM users"));
echo number_format($total_cash);
?>
</p> paid out!
I know GetNumRows
will always show 1
as there's only 1
row, but I don't know what to use instead, can anybody guide me?