I am trying to use updateAll but always getting this error.
$type = "one"; $v = 1; $serv_id = 1; $cust_id = 1; $bmw_form_id = 1; $tran_id = 1; $criteria = new CDbCriteria; $criteria->condition= 'bmw_form_id LIKE "%:bmw_form_id%" AND serv_id = :serv_id AND cust_id = :cust_id AND tran_id = :tran_id'; $criteria->params = array(':yp0'=>$v, ':bmw_form_id' => $bmw_form_id, ':serv_id' => $serv_id, ':cust_id' => $cust_id, ':tran_id' => $tran_id); $update = Tablename::model()->updateAll(array($type=>$v),$criteria);
Always get this error:
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 `tablename` SET `transfer_station`=:yp0 WHERE bmw_form_id LIKE "%:bmw_form_id%" AND serv_id = :serv_id AND cust_id = :cust_id AND tran_id = :tran_id
I noticed in the error that it was creating a :yp0 param so I included it, same error with or without that included.
Also tried replacing the variables in the update array to hard values and still the same problem. The value of teh column is being made a param, so still :yp0 and still invalid number of parameters error.
Any idea what I’m doing wrong?