lansing
06-22-2006, 03:31 PM
I am trying to make a report generation page that will display data between certain dates. I first need to select all data that is in the current month. I want to be able to select all data in any given month by the user entering in the month.
The second thing I need is to be able to select the data on a weekly basis...like week 1 2006 = bla bla, week 2 2006 = bla bla, week 3 2006 = bla bla, etc. I would like to be able to have it go through week 52 of the year, but be able to show like Month = June, but Week 1 of June 2006 = bla bla, Week 2 of June 2006 = bla bla, etc.
The third thing I need is to be able to generate Y-T-D reports for the current year only. I have used the links below as help, but I get errors. I will post my errors & code below. I can't even get this to work to get the data from the last 7 days.
http://codingforums.com/showthread.php?t=80896
My Error: Parse error: syntax error, unexpected T_STRING in C:\XAMPP\xampp\htdocs\My Sites\Members - MGE\cp\reports\monthly.php on line 18 $sql2 = "SELECT SUM(profit) AS sum_profit2
FROM $order_table
WHERE order_date <= Date_Format(Now(), "%Y-%m-%d") //This is line 18
AND order_date >= Date_Format(Sub_Date(Now(), INTERVAL 7 DAY), "%Y-%m-%d")";
$result2 = mysql_query($sql2) or die(mysql_error());
$i2 = mysql_fetch_array($result2);
echo "<br><hr>";
echo $i2['sum_profit2'];
Thanks in advance for your help!
The second thing I need is to be able to select the data on a weekly basis...like week 1 2006 = bla bla, week 2 2006 = bla bla, week 3 2006 = bla bla, etc. I would like to be able to have it go through week 52 of the year, but be able to show like Month = June, but Week 1 of June 2006 = bla bla, Week 2 of June 2006 = bla bla, etc.
The third thing I need is to be able to generate Y-T-D reports for the current year only. I have used the links below as help, but I get errors. I will post my errors & code below. I can't even get this to work to get the data from the last 7 days.
http://codingforums.com/showthread.php?t=80896
My Error: Parse error: syntax error, unexpected T_STRING in C:\XAMPP\xampp\htdocs\My Sites\Members - MGE\cp\reports\monthly.php on line 18 $sql2 = "SELECT SUM(profit) AS sum_profit2
FROM $order_table
WHERE order_date <= Date_Format(Now(), "%Y-%m-%d") //This is line 18
AND order_date >= Date_Format(Sub_Date(Now(), INTERVAL 7 DAY), "%Y-%m-%d")";
$result2 = mysql_query($sql2) or die(mysql_error());
$i2 = mysql_fetch_array($result2);
echo "<br><hr>";
echo $i2['sum_profit2'];
Thanks in advance for your help!