Integrity constraint violation: 1062 Duplicata du champ '0'

Integrity constraint violation yii\db\IntegrityException SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicata du champ 0 pour la clef PRIMARY The SQL being executed was: INSERT INTO `equipment` (`equi_name`, `equi_SN`, `equi_int

 

Integrity constraint violation – yii\db\IntegrityException
 
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicata du champ '0' pour la clef 'PRIMARY'
The SQL being executed was: INSERT INTO `equipment` (`equi_name`, `equi_SN`, `equi_intro`, `equi_state`, `equi_place`, `addtime`, `code`) VALUES ('1', '1', '1', '1', '1', '1457513867', '1')
Error Info: Array
(
    [0] => 23000
    [1] => 1062
    [2] => Duplicata du champ '0' pour la clef 'PRIMARY'
)
   解决方法,进入http://localhost/phpmyadmin,把对应的表的所有数据删除即可
 
      但这是治标不治本的方法,经过检查,我是因为在设计数据库的表的primary key的时候,没有设置AUTO-INCREMENT。通过phpmyadmin修改即可。如下:
     
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐