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

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.

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.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.