0

Hi need some help.I am creating a small hotel booking system.I have a mysql Db whith
tables rooms, clients, bookings,prices,supplements, supplements booked.
I have a search form. Clicking on a calendar img will display a calendar.Clicking on the calendar
will insert the date in the box.Also I can select n.persons, nights,adults,children etc.
Here I am stuck.I need some php code that will process this data and retrieve available rooms
from the rooms table, for a specified arr/dep date. Thank you

2
Contributors
2
Replies
16
Views
3 Years
Discussion Span
Last Post by Fiorentino01^
0

I would suggest you start writing some code and post here if you face problem in the same.

Follow the following:
1. get all input values
2. execute a SELECT query to find rooms which are avaailable in the selected dates (apply inner join on Room table and room_booking table)
3. check if the room is suitable for number of persons selected and also check other details(if required).

Please start writing some code and post you code with problem.

0

Hi, here is some code I tried.What it does it selects all rooms ignoring the dates that I have specified, also some rooms are occupied on those dates so it should list only the available ones.I don't know how to correct this.

SELECT  *
FROM    rooms
WHERE   number NOT IN
        (
        SELECT  number
        FROM    bookings
        WHERE   startDate >= '2013-08-16'
                AND endDate <= '2013-08-19'
        )
        AND number NOT IN
        (
        SELECT  number
        FROM    bookings
        WHERE   startDate >= '2013-08-16'
                AND endDate <= '2013-08-19'
        )



    My tables are:
    bookings  id,startDate,endDate,room,idClient,totalPrice
    rooms  number,floor,type,extraBed,optionals
    prices  startDate,endDate,roomType,price
    clients  id,name,address,phone

    plus table supplements and booked_supplements

    All of this works from the command line but I need it to be working from the webpage.I know I am asking too much somebody in a forum that I won't mention the name told me to hire a programmer, I thought that a forum of experts should help somebody that is trying to become a programmer, needles to say that I won't ask them again.Thanks a lot.
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.