Answer the question
In order to leave comments, you need to log in
Why does an error pop up when executing a request?
Hello! When executing a SQL query in Laravel, an error pops up:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'users_username_unique' (SQL: insert into `users` (`email`, `password`, `activationCode`, `isActive`, `updated_at`, `created_at`) values ([email protected], y$KYlaTrJ4JlItR3BTQT81D.el3mt4A.Uam9DvG.6FFLKBohCaGPxQC, CMo0BXN3Dj6cM3pV, 0, 2016-06-29 13:06:38, 2016-06-29 13:06:38))
Answer the question
In order to leave comments, you need to log in
You have a users_username_unique field in your table that has a unique index applied to it.
The table already has an entry with users_username_unique = "".
You are inserting into this table without specifying this field, so an error occurs - an attempt to create another record with users_username_unique = "".
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question