CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Year & Month Archive

Print topic Send  topic

Author Message
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
View profile  Send private message
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
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.