Column Totals

From: Date: Mon, 15 Nov 2004 18:01:17 +0000
Subject: Column Totals
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-202057@lists.php.net to get a copy of this message
I am trying to get the total sales revenue for each day of the month, and having no luck at all. 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'"; I also tried, among many, many things, to use a for loop to get the sum for each date, month to date, such as: $Today = date("d"); for ($i = 1; $i < $Today; $i++) { $query = "SELECT SUM(Revenue) FROM Sales WHERE Date='$i'"; } In case it helps, sample table data might look like this: OrderNo OrderDate Revenue 1111 1 79.95 1112 1 39.95 1113 3 89.95 and I am trying to produce something that would show: <TABLE> <TR> <TD>Date</TD><TD>Revenue</TD> </TR> <TR> <TD>1</TD><TD>119.90</TD> </TR> <TR> <TD>2</TD><TD>0.00</TD> </TR> <TR> <TD>3</TD><TD>89.95</TD> </TR> </TABLE> PLEASE HELP. PLEASE!!!!!! And many, many thanks in advance!!!!

« previous php.general (#202057) next »