how to make a reservation

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
m2babaey
Forum Contributor
Posts: 364
Joined: Sun May 20, 2007 9:26 am

how to make a reservation

Post by m2babaey »

Hi
I plan to code a reserving system for say a hotel
I'm thinking about a good database structure and querying
1 solution is:
if i want to reserve a room from July 15th for 5 days I query the database in a for loop for the days 15th, 16th until 20 of July in a table with reserved days ( i may have to count the number of results to compare with my capacity of people ect)
what suggestions or experiences do you have
thanks for your help
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: how to make a reservation

Post by Mark Baker »

m2babaey wrote:if i want to reserve a room from July 15th for 5 days I query the database in a for loop for the days 15th, 16th until 20 of July in a table with reserved days ( i may have to count the number of results to compare with my capacity of people ect)
Surely better to work out the date of the last night as first night + days, and then look for a room that was not booked between those dates.
Post Reply