Answer the question
In order to leave comments, you need to log in
What can cause two queries to the database instead of one?
Because of what PHP can make a request to the database 2 times?
So it turns out that 1 out of 1000 times it can happen by chance that the same record is added to the database twice.
How to find the problem and avoid it?
At the beginning of the script, there is a check for an existing entry with the same name.
So it turns out that two queries to the database are made, and not two script triggers repeatedly.
Answer the question
In order to leave comments, you need to log in
Apparently a classic race condition. Checking inside your PHP code does not check or guarantee anything when running in multiple parallel processes:
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question