Help With MySql Column ??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Coldman
Forum Newbie
Posts: 15
Joined: Thu Sep 06, 2007 10:15 am

Help With MySql Column ??

Post 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
Coldman
Forum Newbie
Posts: 15
Joined: Thu Sep 06, 2007 10:15 am

Post 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");
Post Reply