RE: Column Totals

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[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']

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux