Rooms Time Slot Availability

Hi Experts,
I am working on a web project where I have different kinds of meeting rooms (room1, room 2, room 3) and more can be added by the admin. Each room have different quantity as well.

So my table structure is
Table: Room
room_id
room_name
room_qty

Table: Booking:
room_id
fromtime (Datetime format)
totime (datetime format)

I want to check the availability of rooms according to time depending on the user input.  how can I do that?

Cheers!!!!!
Rahul SehrawatAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Daniel WilsonCommented:
Find all rooms available (not booked) between Sept 1 and Sept 3:
Select R.* from
Room R Left Join
(Select R2.room_id from Room R2 Inner Join Booking B on R2.room_id = B.room_id
Where fromtime <= '2014-09-03' and totime >= '2014-09-01') Booked on R.room_id = Booked.room_id
Where Booked.room_id is NULL

Open in new window


Obviously, the dates in your query replace the literals in mine.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ray PaseurCommented:
This is called a "resource scheduling" calendar.  Please see Practical Application #12 in this article (you may want to read the entire article to know what you're getting into before you try to use the Application #12 code).
http://www.experts-exchange.com/Programming/Languages/Scripting/PHP/A_201-Handling-date-and-time-in-PHP-and-MySQL.html
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.