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:[EMAIL PROTECTED]]
Sent: Friday, March 08, 2002 2:17 PM
To: [EMAIL PROTECTED]
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


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to