r/PHPhelp • u/MonsieurKyro • Oct 09 '17
Checking for availability between dates
So basically I am to make a reservation system for a resort. I have already made a database: https://imgur.com/f9aLyFZ. I really need to know how to check if dates are available when making a reservation.
So far I did this: $sql = "SELECT * FROM room_type_tbl
INNER JOIN room_tbl ON room_type_tbl.room_type_id=room_tbl.room_type_id
WHERE room_type_tbl.room_capacity='$roomcap' && ('$datein'>booking_tbl.checkin_date && '$dateout'<booking_tbl.checkoutdate)
";
if ($conn->query($sql) === TRUE) {
//echo "Table MyGuests created successfully";
} else {
echo "Error creating table: " . $conn->error;
}It's not working and I'm about to go mad. Please help me.
8
Upvotes
1
u/fz-09 Oct 10 '17
Are you trying to obtain all rooms with a given room capacity that are available on a given day?