Jump to content


booking system

  • Please log in to reply
1 reply to this topic

#1 noobism

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 18 April 2004 - 05:00 PM

I really need help! I am working on a hotel booking site but i am stumped on how to perform a simple check on a startdate and an end date a user enters to see if there are any types of rooms availble that they have specified.

For instance they enter the start and end date on the form together with the number of adults & children that will be staying and select various room options such as smoking, non-smoking, PC' or network connection required and finally the type of room, single, double & conference hall etc. Currently there are 10 single rooms and 10 double rooms with 3 conference halls. I wish to use this data to check the database for any bookings which collide in between those given dates for their chosen room type and then return some sort of feed back to the user letting them know that there are no single rooms availble for example in those 2 dates. I am developing the site through dreamweaver at the moment.

The rooms table consists of the following

RoomID (auto incremented)

the bookings table has the following information


All most forgot the dates are entered in the following format yyyy-mm-dd. Also if the room is availble I wish for the user to be taken to a confirm bookings page which takes the values added on the previous form and has them availble on the new page for confirmation.

#2 Shaun

  • Members
  • PipPipPip
  • Advanced Member
  • 63 posts
  • LocationMidlands

Posted 23 April 2004 - 06:06 PM

Ok, i think this is what your looking for.

// Change this to the day in the future
$day = 10;

// Change this to the month in the future
$month = 12;

// Change this to the year in the future
$year = 2004;

// You do not need to edit below this line

// $days is the number of days between now and the date in the future
$days = (int)((mktime (0,0,0,$month,$day,$year) - time(void))/86400);

echo "There are $days days until $day/$month/$year";


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users