Yii 更新数据时报错:列名必须是一个字符串或者数组


[error] [exception.CDbException] exception ‘CDbException’ with message ‘列名必须是一个字符串或者数组’ in D:\xampp\htdocs\yii\framework\db\schema\CDbCommandBuilder.php:722
Stack trace:
#0 D:\xampp\htdocs\yii\framework\db\schema\CDbCommandBuilder.php(519): CDbCommandBuilder->createInCondition(Object(CMysqlTableSchema), NULL, Array, NULL)
#1 D:\xampp\htdocs\yii\framework\db\ar\CActiveRecord.php(1689): CDbCommandBuilder->createPkCriteria(Object(CMysqlTableSchema), NULL, ”, Array)
#2 D:\xampp\htdocs\yii\framework\db\ar\CActiveRecord.php(1070): CActiveRecord->updateByPk(NULL, Array)
#3 D:\xampp\htdocs\yii\framework\db\ar\CActiveRecord.php(795): CActiveRecord->update(NULL)

因为yii一个表里必须有一个主键,所以看看数据库吧,我的这个表中确实没有设置主键,所以就报错了,插入数据是不会报错的,只有更新数据是报错。

普人特福的博客cnzz&51la for wordpress,cnzz for wordpress,51la for wordpress