Hi
i am super new to php/mysql etc. i am just trying to do a room availability system.
I have 5 rooms in 5 different category. i like to know how to design a DB and write a php that takes two different dates[checkin date / checkout date] and verifies the DB for availble rooms. can somebody help me please.
Thanks
krs

    Writing the PHP for these kinds of systems isn't the hard part. The hard part is that you often have a person who can make reservations who doesn't have access to a computer. Imagine if you had a secretary or someone who wanted to help a customer reserve the room for 5:00 pm on Saturday. The secretary wouldn't know if the web site already reserved the room. Likewise, the web site wouldn't know if the secretary previously reserved the room.

    One way to handle this is to give the secretary a computer or a cell phone. With a cell phone, the secretary could make reservations via SMS messages - and learn about reservations made online via SMS messages. This solution puts added work on the programmer who has to build cell phone messages into the system.

    The other way to handle this is to tell the secretary that the only slots they are allowed to reserve are evenings and to program the web site that the only slots it's allowed to reserve are days. This way, neither can ever make a reservation for a time that the other already reserved. Unfortunately, this is inconvenient for the customer.

    Once you work out how you will handle that problem, then you can proceed to do the following:

    1. Learn how to read/write to databases from PHP. There are lots of tutorials on the Web. Check Google.

    2. Think about how to "place a hold" on a slot. For example, if a user checks to see what slots are available, and then they pick the 5:00 pm Saturday slot, and then it gets taken while they are filling in their name and address, that would be really inconvenient for the customer. You need to think of a way to temporarily hold a slot while the customer fills in their information.

    There are lots of ways to handle that issue. One is to tell the customer that they have two minutes to fill in their name and address. Slots would have three states: Available, On Hold, and Reserved. You mark it reserved for 2 minutes while the customer fills in their name and address. If they fail to do that, then you mark it "Available" again. Another way to handle the problem is to make the user give all their information when they start using the page. Then you show them available slots along with buttons that say, "I'd like to reserve this". When they click the button, it's theirs. Use Ajax to change the wording on the button if someone else reserves the room.

    This project will take you a few weeks as you learn how to work with databases from PHP. That's where I would start.

      Write a Reply...