0
我已经调用了一个函数。获取表号(结果= 0)结果并更新相同的表值0到1.我正在使用更新query.i已运行此函数返回错误::缺少CDbCommand :: update()参数2。Yii foreach错误?
public function newdisplaycontent()
{
$count = Yii::app()->db->createCommand()
->select()
->from('scrolltable')
->where('result=:result', array(':result'=>0))
->queryAll();
$rs=array();
//print_r($count);
foreach($count as $item){
//process each item here
$rs=$item['ID'];
$user=Yii::app()->db->createCommand()
->update("scrolltable SET result = 1")
->where('ID=:id', array(':id'=>$rs));
}
return $rs;
}
感谢您的功能帮助..
感谢它的工作正常 – Kannan