12-11-2007, 02:09 PM
|
#1 (permalink)
|
|
The Frequenter
Join Date: Nov 2007
Location: Netherlands
Posts: 460
Thanks: 49
|
MySQL Query; Counting and adding values
I myself find this a little bit disturbing. It sounds so easy, so practical and so common to use, but I can't seem to grasp it. Not even FIND OUT how it works. Thats why this kinda belongs in the "Absolute Beginners" board. :P
I want to add values, for example I've got a table layout:
PHP Code:
id-- itemname-- itemcosts--
1 item1 1
2 item2 7
3 item3 2
Adding the values itemcosts in a for/foreach/while loop will result in the integer 10. The point is, I want this done WITHOUT a loop of any kind. I want the mySQL Query to do the work for me. I've conciddered the COUNT option but else it's all a blank.
So, in 1 query, lets say $fCount, I want to get the integer 10.
Can anyone help me out here? :)
|
|
|