Check if time already occupied using sql query?
I’m currently developing s reservation system for meeting rooms, I’m having trouble checking the time range if it is occupied. Example 9:00 – 11:00 is already occupied if the other user will set or input 9:30 – 10:30 alert must show that time is already occupied and the reservation will not save to the database.
this query is what I’ve tried, but it only works when the inputted time-in and out has the same value..
SELECT * FROM `reservation`
WHERE time_in = '$time_in' AND time_out = '$time_out' AND day = '$Fday' AND meeting_table = '$selected_radio'
$time_in,$time_out,$Fday is the value in the selection box that the user set their time. And the $selected_radio is the value of selected radio for their desired area to reserve.