Re: Adding totals
| From: | Adam Royle | Date: | Tue, 21 May 2002 05:11:29 +0000 |
| Subject: | Re: Adding totals | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-19308@lists.php.net to get a copy of this message | ||
This should be it (if I am understanding you correctly).
Adam
$strSQL = "SELECT SUM(columnName) as sum FROM tblName";
$result = mysql_query($strSQL);
while ($row = mysql_fetch_array($result)){
$total = $row["sum"];
}
--------------------------------
Hi all,
Is there a way for me in PHP4 to add all the contens (floating numbers) =
of a cartain column whithin a row and show up the result? I have several =
time inputs and need to show the total.
Thanx.
Cesar Aracena
caracena@infovia.com.ar
Neuquen, Argentina