Reputation: 6251
My PHP/MySQL code to INSERT
a user account is something like:
My understanding it that, when multiple scripts are being run to insert user accounts with the same username, they may encounter a race condition and try to insert the same username. How can I prevent this?
Upvotes: 2
Views: 358
Reputation: 1152
You could make the column 'username' unique. That way, one of those commits will fail since it would violate that constraint.
Upvotes: 1