关于Yii框架更新数据库的问题

框架用的是Yii的1.1版本,

$count=EblsGoods::model()
->updateAll(
['Stock'=>100],'Id=:test1 and BeeGoodId=:test2',array(':test1'=>1,':test2'=>8)
);
        

更新数据库的条件是符合Id = 1 and BeeGoodId = 8 , 的Stock更改为100,但是一直会报语法错误, 请问是为什么?

CDbException: CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]:
Column not found: 1054 Unknown column '1 and BeeGoodId' in 'where clause'.
The SQL statement executed was: UPDATE yh_open_ebls_goods SET Stock=:yp0 WHERE Id=:test1 and BeeGoodId=:test2. Bound with :yp0='100', :test1=1, :test2=8
阅读 1.1k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题