1
Here is the problem: I’m creating a system for scheduling meeting room. I would like to assure you that it will not be possible to schedule the same room for the same period. So after filling out the inclusion form in the table, he checks if the time and room in that period are available. Using the BETWEEN between the start time and the end of the schedule, Example if you already have an appointment from 9am to 11am in the meeting room and try to make the schedule from 8:30 to 9:30 he informs that he can not schedule but when having to make the schedule from 9:30 to 10:30 he leaves, I wonder how I can "reserve" this space so that it does not occur scheduling at the same time.
Could post the Query or code you have already implemented?
– Don't Panic
I used the Query below: SELECT * FROM salas_reuniao WHERE meeting_room = '$salaReuniao' AND hour_start BETWEEN '$inicioReuniao' AND '$finalReuniao'
– Mauricio Gomes
And if you tried
hour_start > $inicioReuniao AND hour_start < $finalReuniao
so if the time the meeting starts between an already booked time you will get a return so it is not possible to book the meeting room at that time– R.Santos
For example, if you have a start time in the bank 9:00 and end time 10:00 if you try to put 9:30 will not because it is larger than an initial time and smaller than a registered final time, however placed 10:30 will allow as much as it is larger than a registered initial time is not less than the corresponding final time
– R.Santos
It worked very well only had to make a modification the end result was that "SELECT * FROM salas_reuniao WHERE meeting_room = '$salaReuniao' AND hour_start <= '$inicioReuniao' AND hour_end >= '$finalReuniao' " Thank you very much for your help
– Mauricio Gomes
I answered the question to help those next who might have the same problem :)
– R.Santos