fmpros Posted January 21, 2012 Share Posted January 21, 2012 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 Link to comment https://forums.phpfreaks.com/topic/255449-php-reservation-schedule-time-range-search-help/ Share on other sites More sharing options...
Pikachu2000 Posted January 21, 2012 Share Posted January 21, 2012 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. Link to comment https://forums.phpfreaks.com/topic/255449-php-reservation-schedule-time-range-search-help/#findComment-1309718 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.