Re: Calculating a total price

From: Date: Thu, 15 May 2003 16:27:17 +0000
Subject: Re: Calculating a total price
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-147728@lists.php.net to get a copy of this message
Using MySQL 4.0.12, let me give it a whirl. Thanks! -Scott At 12:17 PM 5/15/2003 -0400, Adam Voigt wrote:
SELECT SUM(SELECT (qty * price) FROM tablename WHERE userid = '1'); Assuming you have a DB with sub-select support, something like that? On Thu, 2003-05-15 at 12:09, Scott St. John wrote: I need some clear eyes :) I have a site in which a customer can select an item and then purchase it. It is not a shopping cart - just a way for marketing departments to place orders for shirts, pens, golf balls, etc. I have a table that holds the price of each item and also a table that holds the quantity they want. Calculating the individual sale items I do this: $order_total = ($prod_qty * $prod_price); But I need to come up with a total price at the end of the transaction, would a foreach array be my best bet? Thanks in advance...... -Scott -- Adam Voigt (adam@cryptocomm.com) Linux/Unix Network Administrator The Cryptocomm Group -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
------------------------------------------------------------------------ Thank you for choosing Talon! Scott St. John Technical Evangelist Talon Network Services, Inc. www.talon.net

« previous php.general (#147728) next »