Jump to content

PHP Reservation Schedule - Time Range Search - Help!


fmpros

Recommended Posts

Hi Folks,

 

I'm creating an equipment reservation system for a client.  Every reservation has an equipmentID, ReservationDate, StartTime, EndTime.  So, basically my script searches existing records for a given date and EquipmentID.  I'm having trouble with how best to approach validation on new reservations to ensure there are no conflicts. 

 

Lets say two existing reservations for a given date/equipment are found.  One reservation has a startTime of 8AM and endTime of 9AM.  The second has a startTime of 12PM and endTime of 3PM.  Is there a simple way to check if the user's submitted values for StartTime and EndTime conflict with existing reservations? 

 

Any input would be greatly appreciated!  Thanks!

 

-John

Assuming you're using DATETIME fields for the start and end times, you can query to see if the proposed start or end of the next rental of the same equipment is between the start and end times of any existing reservations.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.