» Quick Links
You can make money on these forums
We Share profits with you
Google
Google Adsense
Google Adwords
YPN
Yahoo
MSN Search
Web Directories
Web Hosting
Web Hosting Offers
Hosting News
Suggestions
Link Building
Domain Names
PHP Forums
MySQL Forums
» More Links
OSP News
Reseller Hosting
Shared Hosting
Dedicated Servers
Google Adsense
Search Engine Marketing
Link Development
Affiliate Marketing


» Advertising
Multiple DC PR Check

Free SEO Tools


Go Back   Webmaster Forums > Website Developement / Programming > PHP Programming and Tips

PHP Programming and Tips Discuss about PHP programming and Share Tips. Ask questions about Scripting and Errors.

Reply
 
Thread Tools Display Modes
  #1  
Old 08-22-2006, 12:37 PM
gower gower is offline
OSP Starters
 
Join Date: Aug 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
gower is on a distinguished road
Default Math Op Addition of Values in repeated table

I have a form on my site which allows the editing of a purchase order. These details are contained within a PO table. I have a double type value within this called total. Primary key is POID, a unique, autoinc value.

Also on this form, you are able to attach products to this purchase order. These products are entered into a products table separately when the order comes in. Various client required products may have to come from diff suppliers hence the PO's.

Once the product is attached to the PO, by a unique POID, it displays on this edit page in a repeated table, which shows all products with this POID value.

I need to somehow total the cost values of each product, from the product table, and have the total inserted into the total value for the purchase order they are attached to.

Best regards
This total will then be dynamically displayed on the generated PO ready for printing / faxing /emailing etc.

I -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Revenue Sharing Ads ( ?):
  #2  
Old 08-22-2006, 12:39 PM
dreamers dreamers is offline
Junior Member
 
Join Date: Jul 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
dreamers is on a distinguished road
Default

Try this code

SELECT SUM(price) as total FROM products WHERE POID = '$POID' GROUP BY POID

that should total up all items with that POID -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Reply


Thread Tools
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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
unable to add posts to a phpbb table after moving servers. tanny MySQL Forums 3 02-13-2007 02:44 PM


All times are GMT. The time now is 03:14 AM.