RE: [PHP] Column Totals
| From: | Jay Blanchard | Date: | Mon, 15 Nov 2004 18:15:57 +0000 |
| Subject: | RE: [PHP] Column Totals | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-202060@lists.php.net to get a copy of this message | ||
[snip]
The following query seems to return an empty string, which should only
give
me the total for the entire column anyway.
$query = "SELECT SUM(Revenue) FROM Sales WHERE Date='$Date'";
[/snip]
$query = "SELECT SUM(Revenue) AS Revenue FROM Sales WHERE Date='$Date'";
note the AS statement---------^
$foo = mysql_query($query, $connection);
$bar = mysql_fetch_array($foo);
echo $bar['Revenue']