Hi,
I'm trying to figure out how I would check if two date ranges exist in 2 different fileds in the database. So if the check in date and the departure date were already booked then spit out a message.
So user has the following input page presented to him/her:
Check-in Date: 01-03-2005 ($InDD,$InMM,$inYYYY)
Check-out Date: 05-03-2005 ($OutDD. $OutMM. $OutYYYY)
User click submit
I convert the input fields into 2 string values like so :
$dateIn= $InDD."-". $InMM."-". $InYYYY;
$dateOut= $OutDD."-". $OutMM."-". $OutYYYY;
Ok how do I check the date ranges for both fields in the database?
I tried the following with no luck
$query_rsDates = "SELECT * FROM table where field1 between '$dateIn' and '$dateOut' AND field2 between '$dateIn' and '$dateOut'";
I also tried:
$query_rsDates = "SELECT * FROM table where field1 => '$dateIn' and =<'$dateOut' AND field2 =>'$dateIn' and =<'$dateOut'";
i'm a total newbie so any help would be much appreciated.