RE: [PHP-DB] Display results of SUM of an colomn

From: Date: Thu, 18 Oct 2001 14:07:08 +0000
Subject: RE: [PHP-DB] Display results of SUM of an colomn
Groups: php.db 
Request: Send a blank email to php-db+get-13486@lists.php.net to get a copy of this message
$query = "SELECT sum(my_column) AS total FROM mytable WHERE some_condition"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result); print "Sum of my_column is: ".$row['total']."<BR>\n"; -----Original Message----- From: Mark Weber [mailto:Mark.Weber@kabelfoon.nl] Sent: Thursday, October 18, 2001 12:50 AM To: php-db@lists.php.net Subject: [PHP-DB] Display results of SUM of an colomn Hello Everybody, I'am a new php and mysql user, I have already build a database with 4 coloms. Now I want to display the sum of all values of 1 of these coloms, I want to display it within PHP. Has anyone an example how to display an result of 1 colom, I can't get it work. With kind regards, Mark Weber Email Thuis: Mark.Weber@kabelfoon.nl Homepage: http://www.knotwilgen.com

« previous php.db (#13486) next »