Re: php/mysql simple math
| From: | Richard Lynch | Date: | Thu, 18 Jul 2002 23:05:09 +0000 |
| Subject: | Re: php/mysql simple math | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-108373@lists.php.net to get a copy of this message | ||
>I have created a table which has a column called cost. How do I add up all
>the numerical data in the cost column and display that on a webpage?
<?php
$query = "select sum(cost) from whatever where blah, blah, blah";
$cost = mysql_query($query) or error_log(mysql_error());
$cost = mysql_result($cost, 0, 0);
?>
--
Like Music? http://l-i-e.com/artists.htm