alani Posted September 28, 2007 Share Posted September 28, 2007 Hello, I need some help in a script that i am trying to build few days now. I have a MySQL with hotels information including the seasons that each hotel supports. For example, between 1/7/2008 and 30/8/2008 is the full season of the hotel and the price per day is 20 €. All the other dates is the low season of the hotel and the price per day is 15 €. The problem is that if someone try to make a booking from 25/8/2008 until 5/9/2008 the system must be able to calculate 20 € for the first 5 days and 15 € for the rest of them. In few words my problem is that i can't calculate the price for a booking that it will be requested on the change of the hotels seasons. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/71035-hotel-pricing-per-season/ Share on other sites More sharing options...
cooldude832 Posted September 28, 2007 Share Posted September 28, 2007 Yes I have an idea. Make your table like this BookingID (integer) RoomID (integer) Date (Date only, no need for time) Cost (Integer) Booked (bool type) BookedID (Integer) So each day will have its own info. Then when a booking is made you just black out this day by saying update `table `set Booked = 1, BookedID = $booker where Date > Start_Reservation and Date <= End_Reservation then have a second table that stores the bookers info (based on bookedID) so you can have it all later. Then to get a price you can just query it for sums of them based on cost and then add it up using a simple math function. Quote Link to comment https://forums.phpfreaks.com/topic/71035-hotel-pricing-per-season/#findComment-357185 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.