Hi ppl

I am developing website for my friend's very small resort, please see

this resort have 8 rooms in total and all rooms are of same type so every room is equally priced.

I just need code or logic to check availability of given no. of rooms on given check in and check out dates.

when somebody makes a reservation, details that go in reservation table is:
booking_id
customer name
email
check-in date
check-out date
no. of rooms

Please help this is very critical as i will be integrating paypal also, so there should be no confusions...

thanks in advance

Recommended Answers

All 8 Replies

You can execute following query to determine whether new reservation for any room is confilicting with existing reservation for that room.

select * from reservtable where '{$fromdate}' <= check_out_date and '{$todate}'>= check_out_date and room='{$roomno}'

if you find a solution please let me know
i am looking for the same thing
[removed email]

Member Avatar for diafol

Sorry to sound grouchy, but have you got anything yourself or do you expect some free work from scratch? If you post what you have, e.g. mysql queries/table structure/php code, I'd be happy to help.

Not Complate script, u must DB

commented: Why did you drag up this old thread to post a half-coherent fragment of an answer? -2

your all useless

commented: You registered just to post this? You win teh intarnets. -2
commented: Useless post. -1

If I understand it correctly, it is not a coding problem but you want to now how you can check if a room is free or not.

I had the same problem with a holiday home rental system years ago and solved it this way. Create a table with 365 records in it. This table has the following fields: id, date, number.
At the start of the year the field number will be 8 for every record.

As a customer selects a start and end date you first check to see if the start date is in the future and before the end date. If so, the selection is valid. Now you need to check if there is a room available.
Select from the table everything where date => startdate and date < enddate. Use a loop to see if any number field is 0 (meaning - nothing available). But if nothing is 0, subtract 1 from number and store it in the table again. A fragment of your table might look like
2010-05-01 8 (all rooms still free)
2010-05-02 7 (one room booked)
2010-05-03 0 (all rooms booked)
2010-05-04 4 (some rooms still free)
and so on.

It is even better to check for free rooms before the new customer can make a selection and display a calendar like selection method for instance with green and red colors that show what is free and what is not.

Hi ppl

I am developing website for my project which is Venue/Halls booking system for events like wedding birthday partieslike that

I just need code or logic to check availability of list halls for not booked at the same time and show message (this hall is not available for event at the moment).

when somebody makes a reservation, details that go in reservation table is:
booking_id
customer name
email
location of hall
date
time (lunch/dinner)

Please help me at this critical situation.

thanks in advance

commented: Please create a new thread for your problem rather than resurrecting a 12 year old thread. -3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.