$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:[EMAIL PROTECTED]]
Sent: Thursday, October 18, 2001 12:50 AM
To: [EMAIL PROTECTED]
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:     [EMAIL PROTECTED]
Homepage:       http://www.knotwilgen.com


-- 
PHP Database 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