Page 1 of 1

Help With MySql Column ??

Posted: Sat Oct 06, 2007 12:52 am
by Coldman
I need to get the sum of one column of the MySql table.
I am using
SELECT SUM(FieldName) from table where ........
but it's not working
please help

Posted: Sat Oct 06, 2007 1:25 am
by Coldman
I Found the solution anyway Thanks

$result = mysql_query ("SELECT SUM(TotalPrice) as sum FROM cart where CartID=$CartID ");

$sum = (int) mysql_result($result,0,"sum");