RE: [PHP-DB] Is this possible in mysql?

From: Date: Fri, 08 Mar 2002 19:40:50 +0000
Subject: RE: [PHP-DB] Is this possible in mysql?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-17584@lists.php.net to get a copy of this message
Leif, IF i understood this correctly you would like to add up the values of a particular column and return it to PHP with a different name right? You can do: $query="select sum(column_name) as nameyouwant from tablename"; // this will return the sum of the column in a column called nameyouwant $result=mysql_query($query); $row=mysql_fetch_row($result); // fetching it into array so you can use it.. $sumofnumber=$row[0]; Of course you can use other alternatives to mysql_fetch_row() function. See PHP manual SEction LXI (MySQL functions) for this.. Is this what you are looking for?? Gurhan -----Original Message----- From: Leif K-Brooks [mailto:eurleif@buyer-brokerage.com] Sent: Friday, March 08, 2002 2:17 PM To: php-db@lists.php.net Subject: [PHP-DB] Is this possible in mysql? I need to add up the (integer) values of columns, and return the added up value as one column to php. Is this possible? Or is there something else to do it? (I'd rather not have to mysql_fetch_array() in a while loop and add it up there, it might be a lot of rows) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.db (#17584) next »