how to make a reservation

Discussion in 'PHP' started by promotingspace.net, Jan 24, 2009.

  1. #1
    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
     
    promotingspace.net, Jan 24, 2009 IP
  2. Dox5

    Dox5 Peon

    Messages:
    35
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Or you could do it by
    The database stores 2 dates, the start date 15 July and the end date 20 July.
    When you add a new record, it checks that there is room in those date ranges.
    rather than having a record for each day of the year. Unless i miss under stood that xD
    Might be a little faster as there isnt as much DB Quering to do.
    just my thought
     
    Dox5, Jan 25, 2009 IP