Invalid Parameter Number

when i use CDbCommand to create a sql ,i get this error message,the code like this

$criteria = Yii::app()->db->createCommand()


$criteria->where(array('or' , ' like \'%:key%\'' , 'u.real_name like \'%:key%\'') , array(':key'=>$keyword));

when i get the sql by $criteria->text,i found the sql is all right ,anyone can help me ?

and i found its no erro if i remove the second paramters

Your parameter place holder is inside a string, so the DB engine doesn’t recognise it. Try something like this instead:

$criteria->where(array('or' ,

    " LIKE CONCAT('%', :key, '%')",

    "u.real_name LIKE CONCAT('%', :key, '%')"

), array(':key'=>$keyword));

good , you are right ,thank you very much !