First off, I am not entirely sure how to word this question so maybe this is a duplicate(?). If so, I haven't found the other one and sorry in advance.
I am working on an application where the user can select multiple resources within a certain time frame. Something like room and group.
When verifying this I need to be sure no group or room is selected twice within the same time frame.
I am a bit unsure as to how I can make sure nothing is selected twice within the same time frame and keeping the application snappy.
I am using PHP7 and MySQL
If I am not wrong, you are talking of a feature requirement similar to a Ticket Booking system where no two users can buy the tickets for the same seat?
If yes, then you need to follow a two-step registration/booking process.
Step 1: When somebody selects a seat/room then temporarily mark it as unavailable in the temp database table. If a new user tries to select the same room the user will see Unavailable message and cannot select it.
Step 2: The selected seat/room will be blocked for say 10 minutes until the booking is confirmed. If the first user fails to complete the booking process then the seat/room will be automatically made available again for everybody after 10 minutes. And, if the booking is confirmed then the seat/room will be permanently unavailable until cancelled by the user (if your system allows this functionality).