noobism Posted April 18, 2004 Share Posted April 18, 2004 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) Price noBeds Description roomNumber the bookings table has the following information bookingID customerID roomID startDate endDate adults children roomOptions 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. Quote Link to comment https://forums.phpfreaks.com/topic/1800-booking-system/ Share on other sites More sharing options...
Shaun Posted April 23, 2004 Share Posted April 23, 2004 Ok, i think this is what your looking for. <?php // 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"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/1800-booking-system/#findComment-5928 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.