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 - $sql = 'SELECT * from sales where date = today';
-
$query = mysql_query($sql)
Weekly - $sql = 'SELECT * from sales where date <= 8 days';
-
$query = mysql_query($sql)
Monthly
For this, I have a drop down with names of all the months of the year as below - <select name=Month>
-
<option value=>Select month
-
<option value=1>January
-
<option value=2>February
-
<option value=3>March
-
<option value=4>April
-
<option value=5>May
-
<option value=6>June
-
<option value=7>July
-
<option value=8>August
-
<option value=9>September
-
<option value=10>October
-
<option value=11>November
-
<option value=12>December
-
</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....
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]
This is my table structure.... -
DROP TABLE IF EXISTS `sales`;
-
CREATE TABLE `sales` (
-
`AtlNo` int(10) unsigned NOT NULL auto_increment,
-
`PfiNo` varchar(45) collate latin1_general_ci NOT NULL default '',
-
`Depot` varchar(45) collate latin1_general_ci NOT NULL default '',
-
`CustomerName` varchar(100) collate latin1_general_ci NOT NULL default '',
-
`Address` varchar(100) collate latin1_general_ci NOT NULL default '',
-
`EmailAddress` varchar(45) collate latin1_general_ci NOT NULL default '',
-
`Country` varchar(45) collate latin1_general_ci NOT NULL default '',
-
`Product1` varchar(45) collate latin1_general_ci NOT NULL default '',
-
`Product2` varchar(45) collate latin1_general_ci NOT NULL default '',
-
`Product3` varchar(45) collate latin1_general_ci NOT NULL default '',
-
`TotalProductQuantity` float NOT NULL default '0',
-
`TotalPrice` float NOT NULL default '0',
-
`TruckDetails` varchar(100) collate latin1_general_ci NOT NULL default '',
-
`Destination` varchar(45) collate latin1_general_ci NOT NULL default '',
-
`PreparedBy` varchar(45) collate latin1_general_ci NOT NULL default '',
-
`AuthorisedBy` varchar(45) collate latin1_general_ci NOT NULL default '',
-
`AccountBf` float NOT NULL default '0',
-
`AmountRecieved` float NOT NULL default '0',
-
`LessThisOrder` float NOT NULL default '0',
-
`Balance` float NOT NULL default '0',
-
`Currency` varchar(45) collate latin1_general_ci NOT NULL default '',
-
`Narration` varchar(45) collate latin1_general_ci NOT NULL default '',
-
`TaxesPaid` varchar(45) collate latin1_general_ci NOT NULL default '',
-
`FinanceNote` varchar(45) collate latin1_general_ci default NULL,
-
`SuppliesNote` varchar(45) collate latin1_general_ci default NULL,
-
`Status` int(10) unsigned NOT NULL default '0',
-
`Date` date NOT NULL default '0000-00-00',
-
PRIMARY KEY (`AtlNo`)
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.
Not quite.
I need it to subtract 7 days from the current date.
Any idea for monthly?
Sign in to post your reply or Sign up for a free account.
Similar topics |
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...
|
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...
|
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...
|
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....
|
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...
| |
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...
|
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...
|
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...
|
by: Jack |
last post by:
Any recommended books on PHP-MYSQL with serious examples in c++?
Regards
Jack
|
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...
|
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,...
| |
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...
|
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,...
|
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...
|
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...
|
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...
|
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...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |