I have two fields, check_in and nights.
Nights are inclusive of the check_in date. So if a customer books 1 night, he would then check_out the following day and the room would then be available for booking (unless already booked by somebody else).
Here is an example of a couple records within my table,
customer room check_in nights
cus1 test room 2013-01-23 2
cus2 test room 2013-01-25 1
cus3 test room 2013-01-26 4
cus3 has booked a room, they will check into the room on 2013-01-26 and they will stay for 4 nights. this means the room will be unavailable for booking during this time.
So how would I check whether the room was available?
the room should only be available for check_in on 2013-01-30.
All help is appreciated :)