montymoose
Posts: 85
|
| Posted: 10/05/2007, 4:32 AM |
|
Hi,
I have a simple date calculation which I'm not sure how to peform in SQL.
(PHP/MySQL Latest)
I need to make a news archive page with two dropdown menus.
YEAR
2007
2006
2005
etc
MONTH
1
2
3
etc
I get an URL string of the following when the form is submitted: index.php?year=2007&month=4
In the WHERE clause for the grid, how do I compare the single date field to 1 or both of the these URL values?
The users need to be able to bring back a 'whole year' or a 'certain month from a certain year'.
I'm stuck on this one, but might be a simple answer... off to read the mysql site now!
Thanks,
M00S3
|
 |
 |
klwillis
Posts: 428
|
| Posted: 10/07/2007, 1:12 PM |
|
The following should work...
$month = intval(CCGetParam("month",""));
$year = intval(CCGetParam("year",""));
$Component->DataSource->WHERE = "year(datefield) = $year or month(datefield) = $month";
Quote montymoose:
Hi,
I have a simple date calculation which I'm not sure how to peform in SQL.
(PHP/MySQL Latest)
I need to make a news archive page with two dropdown menus.
YEAR
2007
2006
2005
etc
MONTH
1
2
3
etc
I get an URL string of the following when the form is submitted: index.php?year=2007&month=4
In the WHERE clause for the grid, how do I compare the single date field to 1 or both of the these URL values?
The users need to be able to bring back a 'whole year' or a 'certain month from a certain year'.
I'm stuck on this one, but might be a simple answer... off to read the mysql site now!
Thanks,
M00S3
_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"
Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006 |
 |
 |
|