473,513 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help on generating reports in PHP+MySQL...

64 New Member
I need to generate 3 kinds of reports...
I have a date field in MySQl database whose data type id DATETIME

daily
I need to show reports of sales of the day so my SQL should be sth like
Expand|Select|Wrap|Line Numbers
  1.  $sql = 'SELECT * from sales where date = today';
  2. $query = mysql_query($sql)
Weekly
Expand|Select|Wrap|Line Numbers
  1.  $sql = 'SELECT * from sales where date <= 8 days';
  2. $query = mysql_query($sql)

Monthly

For this, I have a drop down with names of all the months of the year as below

Expand|Select|Wrap|Line Numbers
  1.  <select name=Month>
  2.                   <option value=>Select month
  3.                   <option value=1>January
  4.                   <option value=2>February
  5.                   <option value=3>March
  6.                   <option value=4>April
  7.                   <option value=5>May
  8.                   <option value=6>June
  9.                   <option value=7>July
  10.                   <option value=8>August
  11.                   <option value=9>September
  12.                   <option value=10>October
  13.                   <option value=11>November
  14.                   <option value=12>December
  15.                 </select>
I need one to be able to select a month from the drop down then it selects sales of thst month

ie if one selects may,
The sql to do sth like
[PHP] $sql='SELECT * FROM SALES WHERE Date = "'.$_POST['may'].'"';[/PHP]

Some body please help on the technical bit for this..
I'm really stuck and have never done anything like this....
Aug 3 '07 #1
4 8175
ak1dnar
1,584 Recognized Expert Top Contributor
Are you sure about SQL string that you have used to get the MONTHLY report.?
Need to know about the table structure first of all to give any type of comments.

any way one more thing, the way you trying to get the list menu value is incorrect.try ;

[PHP]$_POST['Month'][/PHP]
Aug 3 '07 #2
gnawz
64 New Member
This is my table structure....
Expand|Select|Wrap|Line Numbers
  1. DROP TABLE IF EXISTS `sales`;
  2. CREATE TABLE `sales` (
  3.   `AtlNo` int(10) unsigned NOT NULL auto_increment,
  4.   `PfiNo` varchar(45) collate latin1_general_ci NOT NULL default '',
  5.   `Depot` varchar(45) collate latin1_general_ci NOT NULL default '',
  6.   `CustomerName` varchar(100) collate latin1_general_ci NOT NULL default '',
  7.   `Address` varchar(100) collate latin1_general_ci NOT NULL default '',
  8.   `EmailAddress` varchar(45) collate latin1_general_ci NOT NULL default '',
  9.   `Country` varchar(45) collate latin1_general_ci NOT NULL default '',
  10.   `Product1` varchar(45) collate latin1_general_ci NOT NULL default '',
  11.   `Product2` varchar(45) collate latin1_general_ci NOT NULL default '',
  12.   `Product3` varchar(45) collate latin1_general_ci NOT NULL default '',
  13.   `TotalProductQuantity` float NOT NULL default '0',
  14.   `TotalPrice` float NOT NULL default '0',
  15.   `TruckDetails` varchar(100) collate latin1_general_ci NOT NULL default '',
  16.   `Destination` varchar(45) collate latin1_general_ci NOT NULL default '',
  17.   `PreparedBy` varchar(45) collate latin1_general_ci NOT NULL default '',
  18.   `AuthorisedBy` varchar(45) collate latin1_general_ci NOT NULL default '',
  19.   `AccountBf` float NOT NULL default '0',
  20.   `AmountRecieved` float NOT NULL default '0',
  21.   `LessThisOrder` float NOT NULL default '0',
  22.   `Balance` float NOT NULL default '0',
  23.   `Currency` varchar(45) collate latin1_general_ci NOT NULL default '',
  24.   `Narration` varchar(45) collate latin1_general_ci NOT NULL default '',
  25.   `TaxesPaid` varchar(45) collate latin1_general_ci NOT NULL default '',
  26.   `FinanceNote` varchar(45) collate latin1_general_ci default NULL,
  27.   `SuppliesNote` varchar(45) collate latin1_general_ci default NULL,
  28.   `Status` int(10) unsigned NOT NULL default '0',
  29.   `Date` date NOT NULL default '0000-00-00',
  30.   PRIMARY KEY  (`AtlNo`)
Aug 5 '07 #3
kovik
1,044 Recognized Expert Top Contributor
For weekly, you'll want to have a starting date for the week and an ending day for the week that you are after, and then find all results using the BETWEEN...AND statement.
Aug 6 '07 #4
gnawz
64 New Member
Not quite.

I need it to subtract 7 days from the current date.

Any idea for monthly?
Aug 6 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

6
5451
by: pc_newbie | last post by:
Hi, i got a problem with php->mysql Fatal error: Call to undefined function: mysql_pconnect() in /var/www/update.php on line 4 both php and mysql are installed into debian, but don't know how...
11
4170
by: Mike MacSween | last post by:
My client has an MS Access database application on her local machine. I have full access to that in terms of changing the design. I've got a simple PHP/MySql application on shared hosting, so no...
0
1336
by: Creativy, writing and more | last post by:
Hi all, I'm hoping to find some additional help with a site I'm maintaining for my landlord. I'm trying to grow a web hosting and web design business. I was to have this site as a job that would...
0
1243
by: CNerd2025 | last post by:
HELP! I need somebody HELP! Not just anybody HELP! You know I need someone (with PHP/MySQL knowledge) HELP! You may have noticed the famous Beatles song with some less well-known lyrics....
6
3256
by: TonyB | last post by:
I'm running the zip'd version of PHP (PHP 5.1.2 zip package) downloaded from here: http://www.php.net/downloads.php. PHP won't connect with MySQL. >From docs and threads, it seems enabling...
1
3705
by: Wak | last post by:
I have been searching for ERP system that runs on PHP/Mysql for a med-large sized business. Most of the ones I have found are pretty cheesy and don't do everything a ecommerce company would...
4
2598
by: martinf | last post by:
Hello group, I've inherited a box running FC6. The website I'm trying to copy across to it ran fine on FC5.. PHP & MySQL were set up 'out-the-box' so the site just worked. Somethings...
4
2473
gregerly
by: gregerly | last post by:
Hello All, I just wanted to get some input from the experts, what options are available for generating reports using PHP / MySQL. I can easily create HTML reports, but I'm thinking more along the...
7
1965
by: Jack | last post by:
Any recommended books on PHP-MYSQL with serious examples in c++? Regards Jack
13
2280
by: Richard Brooks | last post by:
Does anyone here open a second MySQL database and use that as a straight IDX type file that points to the record number in the main database, for speed's sake? Some time ago I'd set up a...
0
7267
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7175
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7391
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7120
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5100
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3247
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
466
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.