I am using PHP and MySQL to accept form registrations. Most responses to this question assume that only 1 person is using the application at once. However, any number of people could be completing the form at one time. How do I limit the number of registrants to a given number (1000, for example)? Please consider the following scenario:
- 2:00 pm - User A accesses the form. My code checks the database, and there are 999 entries.
- 2:01 pm - User B accesses the form. My code checks the database, and there are 999 entries. (User A has not submitted the form yet).
- 2:08 pm - User A submits the form. Now, there are 1000 entries. User B is still filling out the form.
Since User B has already started filling out the form (but has not finished), I'd like to let him/her finish. What is the best way to code my application to minimize the likelihood that this scenario will occur?
Thank you.