YT
|
| Posted: 06/03/2002, 10:52 AM |
|
I have a database containing dates within a column of the recordset saved as as the full date i.e. YYYY/MM/DD. I would like the visitor to be able to display all records for one month or one year. How could this be achieived in CC?
|
|
|
 |
Brent
|
| Posted: 06/03/2002, 9:31 PM |
|
I assume you are using CC and PHP.
Create two edit boxes and allow the user to enter a 'from' date and in the other
a 'to' date. The tutorial shows you how to do this. This is pretty simple.
If you want something harder, the other alternative is to create a listbox with:
"2001-01;Jan'01;2001-02;Feb'02;....;2001;Year:2001"
The dates in the listbox are generated when the form opens so that it keeps
increasing as each month goes by. If the user select "Feb'01" the value returned
is "2001-02" so you will build your own $sWhere in the Grid Open event. You
would generate something like "WHERE rcd_date >= $date_start and rcd_date <= $date_end".
You will need to create $date_start and $date_end from the selected item, namely
"2001-02" so $date_start="2001-02-01" and $date_end="2001-02-28".
The latter solution is more elegant but will take a few lines of coding to
build the listbox entries and the $sWhere variable.
|
|
|
 |
|