TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 12-11-2007, 02:09 PM   #1 (permalink)
The Frequenter
 
ReSpawN's Avatar
 
Join Date: Nov 2007
Location: Netherlands
Posts: 460
Thanks: 49
ReSpawN is on a distinguished road
Default 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? :)
Send a message via MSN to ReSpawN
ReSpawN is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 04:44 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design