Jump to content

[SOLVED] echo the sum of a field in a table


lmhart

Recommended Posts

you have to use one of PHP's mysql_fetch_xxxx to get the results from your query

include 'dbc.php';
$result = mysql_query("SELECT sum(record_amount) as total_expense from record");
$row = mysql_fetch_assoc($result);
echo $ow['total_expense'];

 

Edit: beat me to it

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.