checking availability of rooms
This is a somewhat common logical error.

('$checkin' BETWEEN start_date AND end_date) OR
('$checkout' BETWEEN start_date AND end_date)); 


The problem is not the way the query is written, it's that you're using the wrong criteria. A reservation can conflict while neither of these is true, simply by starting before and ending after the desired values.

What you actually need to find is the overlap.

A room is not available if it has any existing reservation with the following conditions true:


a check-in before your desired check-out and
a check-out after your desired check-in


Any reservation that starts before your desired end and ends after your desired start is a conflict.

Stated another way, a check-in after your desired check-out cannot possibly be a conflict, and a check-out before your desired check-in cannot possibly be a conflict.  All others are conflicting.

So you want to identify these reservations:

(end_date &gt; '$checkin') AND
(start_date &lt; '$checkout'); 




Note also that you must never build queries with variable interpolation, as you have done here.  It is an unsafe practice for which there are no genuine exceptions, only excuses.  Use prepared statements and placeholders.