Integrity Constraint Violation: 1062 Duplicate Entry


I have problem when save model: Integrity constraint violation: 1062 Duplicate entry. But I checked in database the value for this column not have.

This problem happend when deleted one record and immediatly create new record with the old value for unique column.

I think this problem happend by cache but not sure and how to fix it?

Please help!!!

Can you show the code you’re using? Are you wrapping the calls in a transaction?

EDIT: Also, which is the unique column and what does it represent?

i guess your are saving record within a loop.So, if this is a case then you should use


//and after