Your query is referencing return_date
, which isn’t a column in the airport_car_parking table.
As for the logic of the query, you want to make sure that the $departure_date isn’t between any row’s departure_date
or arrival_date
. I would recommend the following query –
$chk_date_sql="SELECT * FROM airport_car_parking WHERE '$departure_date' BETWEEN departure_date AND arrival_date;";
And then that query returns with any rows, that means that the requested time will not work.
solved php mysql car parking query [closed]