Custome Query With Cdbcriteria


How can I execute this query with CDbCriteria and CActiveDataProvider?

'SELECT * FROM tbl_post where title LIKE %'.$title.'% ORDER BY title LIKE '.$title.' DESC , title LIKE '.$title.'% DESC'

I finally wrote this:

$criteria = new CDbCriteria;

                        $criteria->addCondition('title LIKE :title');                        

                        $criteria->params = array(':title'=>'%'.$title.'%',':t1'=>$title,':t2'=>$title.'%');;

                        $criteria->order='title LIKE :t1 DESC , title LIKE :t2 DESC';

but got 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: SELECT COUNT(*) FROM `tbl_post` `t` WHERE title LIKE :title