954,585 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to implement check availability in hotel reservation system

Hi ppl

I am developing website for my friend's very small resort, please see [url removed]

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

jyotiu
Light Poster
33 posts since Sep 2008
Reputation Points: 10
Solved Threads: 0
 

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}'
urtrivedi
Nearly a Posting Virtuoso
1,306 posts since Dec 2008
Reputation Points: 257
Solved Threads: 270
 

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

sakisl
Newbie Poster
4 posts since Dec 2007
Reputation Points: 10
Solved Threads: 0
 

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.

diafol
Rhod Gilbert Fan (ardav)
Moderator
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 

Not Complate script, u must DB

gagah
Newbie Poster
1 post since Apr 2010
Reputation Points: 8
Solved Threads: 0
 

your all useless

PotatoJ
Newbie Poster
1 post since Apr 2010
Reputation Points: 7
Solved Threads: 0
 

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.

colweb
Posting Whiz
318 posts since Nov 2007
Reputation Points: 34
Solved Threads: 52
 

Please do not resurrect old threads. Have a look at forum rules .
Please read before posting - http://www.daniweb.com/forums/thread78223.html

Thread Closed.

__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You