hi,
I am getting a error while select multiple check box and insert into mysql table ,Please somebody Help
[u][i][b]CDbException
Column name must be either a string or an array.[/b][/i][/u]
<---------------------------------- This is the error
D:\xampp\htdocs\emerald_erp\framework\db\schema\CDbCommandBuilder.php(828)
816 }
817 if(count($values)===1)
818 {
819 $entries=array();
820 foreach($values[0] as $name=>$value)
821 $entries[]=$prefix.$table->columns[$name]->rawName.($value===null?’ IS NULL’:’=’.$value);
822 return implode(’ AND ',$entries);
823 }
824
825 return $this->createCompositeInCondition($table,$values,$prefix);
826 }
827 else
828 throw new CDbException(Yii::t(‘yii’,‘Column name must be either a string or an array.’));
829 }
830
831 /**
832 * Generates the expression for selecting rows with specified composite key values.
833 * @param CDbTableSchema $table the table schema
834 * @param array $values list of primary key values to be selected within
835 * @param string $prefix column prefix (ended with dot)
836 * @return string the expression for selection
837 */
838 protected function createCompositeInCondition($table,$values,$prefix)
839 {
840 $keyNames=array();
/************* THis is FUNCTION of update query*****************/////
public function actionUpdate($id)
{
$model=$this->loadModel($id);
$menumodel = new MenuRoles;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Roles']))
{
$model->attributes=$_POST['Roles'];
//$roleid = $model->id;
if($model->save()) {
$menumodel->attributes=$_POST['MenuRoles'];
foreach($menumodel->menu_id as $menuid){
$menumodel->menu_id = $menuid;
$menumodel->role_id = 1;
$menumodel->save();
}
$this->redirect(array('view','id'=>$model->id));
}
}
$this->render('update',array(
'model'=>$model,
'menu'=>$menumodel,
));
/
}