
May 14th, 2000, 10:08 AM
|
|
Apprentice Deity
|
|
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237

Time spent in forums: 4 m 8 sec
Reputation Power: 17
|
|
|
You'll need two date fields in your table, start and end. In your form you should ask for month, day and year in seperate fields to make sure you control what order and format the data is in (make sure the year is 4 digits, possibly use an option box??). In your script (I'll use PHP for an example) you can concatenate the year-month-day fields.
$search_date=$year.'-'.$month.'-'.$day;
Then your query would look like:
select * from table_name where $search_date BETWEEN start_date AND end_date;
Because the mysql DATE datatype uses the YYYY-MM-DD format, a string comparison (which BETWEEN will use in this instance) will work.
|