Or like Tom suggested, you can do it with SQL (I'm an idiot... seeing as how
I did this just two days ago)

---------------------
John Asendorf - [EMAIL PROTECTED]
Web Applications Developer
http://www.lcounty.com - NEW FEATURES ADDED DAILY!
Licking County, Ohio, USA
740-349-3631
Ipsa scientia potestas est


> -----Original Message-----
> From: Asendorf, John [mailto:[EMAIL PROTECTED]]
> Sent: Friday, February 16, 2001 9:18 AM
> To: Ben Cairns; [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] My Dilema
> 
> 
> Which database are you using?  It will make a difference in 
> how to do this.
> 
> Generally, you'll want some type of FOR loop:
> 
> ATTENTION:  THIS IS NOT REAL CODE, JUST AN IDEA
> 
> 
> $num_results = count (results);
> 
> for ( $i=1 ; $i <= $num_results ; $i++ ) {
> 
>       fetch_row ( results );
> 
>       $grand_total = $grand_total + results[$i];
> 
> }
> 
> 
> 
> 
> 
> 
> ---------------------
> John Asendorf - [EMAIL PROTECTED]
> Web Applications Developer
> http://www.lcounty.com - NEW FEATURES ADDED DAILY!
> Licking County, Ohio, USA
> 740-349-3631
> Ipsa scientia potestas est
> 
> 
> > -----Original Message-----
> > From: Ben Cairns [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, February 16, 2001 9:10 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-WIN] My Dilema
> > 
> > 
> > I have a slight problem with this....
> > 
> > I am returning numerical values (i.e. 22.64, 2.54 etc. All 
> > with two Decimal 
> > Places) from a database. I then want to add these together.
> > 
> > But, I don't know how many rows there are, so I cant do:
> > $row+$row
> > There may only be one row, or there may be hundreds of rows. 
> > How can I add 
> > all of the values together?
> > 
> > Any help appreciated, cos. I'm stuck!..
> > 
> > -- Ben Cairns - Head Of Technical Operations
> > intasept.COM
> > Tel: 01332 365333
> > Fax: 01332 346010
> > E-Mail: [EMAIL PROTECTED]
> > Web: http://www.intasept.com
> > 
> > "MAKING sense of
> > the INFORMATION
> > TECHNOLOGY age
> > @ WORK......"
> > 
> > 
> > -- 
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: 
> > [EMAIL PROTECTED]
> > 
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: 
> [EMAIL PROTECTED]
> 

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to