I am trying to develop a small program using PHP & MySQL, which compare dates with a database of Start Date & End Date where a number is assigned to each.
When a user enters a Start Date & End Date the program should look thought the database and then output the value assigned to the selected dates.
Database
01-06-2003 till 30-06-2003 => 1
01-07-2003 till 25-07-2003 => 2
26-07-2003 till 05-08-2003 => 3
06-08-2003 till 30-08-2003 => 4
User will input two dates, which will be a start date & end date
Example 1, User Inputs
Start Date: 02-07-2003
End Date: 15-07-2003
Answer Should be:
- 02-07-2003 till 15-07-2003 => 2
Example 2, User Inputs
Start Date: 23-07-2003
End Date: 29-07-2003
Answer Should be:
- 23-07-2003 till 25-07-2003 => 2
- 26-07-2003 till 29-07-2003 => 3
I am thinking of an easy way of doing this, can anyone help me?
chao, xxtravel