PDO Raises "Invalid parameter number: no parameters were bound". I think the :red is causing this error." for a typical insert query.

Hi all,

I’ve a problem with typical insert query.

$sql = “UPDATE mytable SET data=’<p style=\“color:red\”></p>” ;

$command = Yii::app()->db->createCommand($sql);

$command->execute()

this code raises an error

"CDbCommand failed to execute the SQL statement: SQLSTATE[HY093]: Invalid parameter number: no parameters were bound". I think the :red is causing this error.

Is there a way to turn off binding temporarily?

the same code works in my local machine, but not works when it uploaded to a server, why ???

But if the data is not escaped its works in server. Its not possible to pass without escaping…

$sql = “UPDATE mytable SET data=’<p style=“color:red”></p>” ;

$command = Yii::app()->db->createCommand($sql);

$command->execute()

please help…

Thank you all…

Turn on logger, so you can see query that is executed. I think that your query is escaped twice.