日期:2014-05-16  浏览次数:21053 次

yii CDbException
CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`blog`.`articles`, CONSTRAINT `fk_articles_users` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION). The SQL statement executed was: INSERT INTO `articles` (`viewNum`, `commentNum`, `categoryId`, `title`, `content`, `statusId`, `tagId`, `createdTime`, `userId`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6, :yp7, :yp8). Bound with :yp0=0, :yp1=0, :yp2=1, :yp3='1', :yp4='1', :yp5=2, :yp6=1, :yp7=2012, :yp8=0
------解决方案--------------------
字面来看是外键约束错误,你看看是不是数据内容填写的时候重复了,或者外键引用的实体已经不存在了!