$check_in = '2022-03-08';
$check_out = '2022-03-11';
$property_id = 6;
I have three parameters: $check_in
, $check_out
and $property_id
Now I want to check availability of this property before booking.
Since my $check_in
date is 2022-03-08
and $check_out date
is 2022-03-11
then property id 6
should not be entry second time.
Again, if the $check_out date is ‘2022-03-10’ then the entry is not possible.
Booking Table
Property_Id | Booking_Id | Booking_Date | Check_in_Date | Check_out_Date |
---|---|---|---|---|
6 | 02 | 2022-03-25 | 2022-03-10 | 2022-03-15 |
7 | 03 | 2022-03-25 | 2022-03-20 | 2022-03-25 |
8 | 04 | 2022-03-25 | 2022-04-15 | 2022-04-20 |
Please help me to write a SQL query