You are most likely trying to insert a new record in a table with an id number that matches the id number of an already existing record.
In order to give a better response, I would need to see the code that is generating this error.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Suddenly getting wired behaviour in one to one insertion.
I am getting SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry error during insertion.
However, it was working fine in online before and still working fine in local matching.
Any idea why?
It looks like it is trying save Usercities with id=11073 and userid=11073. You already (I am assuming) have an entry in usercities with id=11073.
Please or to participate in this conversation.