Re: math calculations query

From: Date: Thu, 26 Apr 2001 19:42:59 +0000
Subject: Re: math calculations query
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-50488@lists.php.net to get a copy of this message
oh, I am such a bone head.. but the actual question was how to calculate the totals. i have a column on my form that says $qry["price"]*$qry["quantity"] which gives me a column of totals but my question is how to total that up??? any ideas? "David VanHorn" <dvanhorn@cedar.net> wrote in message news:4.3.2.7.2.20010426141815.00c6bc30@mail.cedar.net... > At 08:31 PM 4/26/01 +0100, sean@networkdata.co.uk wrote: > >hi all, > > > >i have a script which selects description, price and quantity from a mysql > >table. > > > >i have displayed the results on a page in the form of description, price, > >quantity but I was wondering how best to go about calculating a total total, > >ie. sum of quantitys multiplied by sum of prices. > > Generally, that's not how you do that. > You'd calculate "extended" prices based on quantity of item and price, then > add all extended prices. > > 1 Thingy $5 Ext= $5 > 2 SuperThingy $3 Ext=$6 > > Total is $11 > > As opposed to > 3 * $8 by the method you described. > > > -- > Dave's Engineering Page: http://www.dvanhorn.org > Where's dave? > http://www.findu.com/cgi-bin/find.cgi?kc6ete-9 > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#50488) next »