我想用CDbCommand运行SQL脚本:
update user set point = point - 2 where user_id = 13 and role_id = 2;
我的代码使用Yii CDbCommand:
Yii::app()->db->createCommand()->update(
'user',
array('point'=>'point + 2'),
array('user_id' => 13, 'role_id'=>':role'),
array('role'=>2)
);
然后我收到错误:
CDbCommand failed to execute the SQL statement: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens. The SQL statement executed was: UPDATE `user` SET `point`=:point
问题是什么?
答案 0 :(得分:3)
这样做:
Currency Int Rate
0 $111.23 23 0.03%
1 $321.23 3 0.10%