12-11-2007, 03:00 PM
|
#2 (permalink)
|
|
Wizard
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
|
If you are displaying the data, you have to use a loop. Just add the costs while you are displaying them and print them after the loop.
If you want it from just a query,
PHP Code:
SELECT SUM(itemcosts) AS fCount FROM table WHERE 1;
That will add all the values of field and assign it to total. Now just use this to print it
PHP Code:
$query = mysql_query("SELECT SUM(itemcosts) AS fCount FROM table WHERE 1;"); $result = mysql_fetch_array($query); $fCount = $result["fCount"];
Last edited by Village Idiot : 12-11-2007 at 04:03 PM.
|
|
|
|