I have problem thinking this trough with PHP & Mysql
. I have read How to implement check availability in hotel reservation system and some more but they seem different.
I have to make a reservation system on which a converence room can be booked for 6hours minimal, so when a user make a reservation on a date e.g 24/04/2012 he then selects the start time of the rental (00:00-06:00, 06:00-12:00, 12:00-18:00,18:00-24:00).
And the total number of hours(6,12,18 etc..) the user wants to rent the room.
The date is stored as a integer(timestamp).
I have two problems with this; I don´t know how to receive all possible days of a month on which the room is still up for reservation and how to check if a new reservation is possible.
I know how to calculate the start date and end date on the users input but I cant find the correct mysql query or php check for availability.
It's probably really simple but somehow because the end date is always variable I just cant find the answer.
Thanks in advance guys!
EDIT Table structure: reservations
id int(11) user_id int(11) reservation_name varchar(255) start_date int(11) end_date int(11)
I believe reservations is the only one relevant