View Single Post
Old 12-11-2007, 03:00 PM   #2 (permalink)
Village Idiot
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

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.
Village Idiot is offline  
Reply With Quote
The Following User Says Thank You to Village Idiot For This Useful Post:
SOCK (12-11-2007)