I am working in a booking system for hotel.
The hotel add the prices for each room by date from and date to.
My problem is only when is the transition date.
For example in DB its:
RoomNumber: 001
DateIn: 2010-09-28
DateOut: 2012-09-30
Price: 150,00
RoomNumber: 001
DateIn: 2012-09-30
DateOut: 2013-03-01
Price: 160,00
RoomNumber: 001
DateIn: 2013-03-02
DateOut: 2013-06-30
Price: 120,00
If the customer want booking the date in and date out:
DateInBooking: 2012-09-28
DateOutBooking: 2012-10-03
Should range the dates and plus the prices:
2012-09-28 = 150,00
2012-09-29 = 150,00
2012-09-30 = 150,00
2012-10-01 = 160,00
2012-10-02 = 160,00
2012-10-03 = 160,00
But i am using if condition to check the date in and date out to plus the prices.
if ( ($DateInSearch >= $rooms_frow["DateIn"]) && ($DateOutSearch <= $rooms_frow["DateOut"]) ) {
But i am not doing the right way.
Please can you help me to find a best way to find and fix it ?
Thank you.