0
CDbCriteria 및 CActiveDataProvider를 사용하여이 쿼리를 어떻게 실행할 수 있습니까?Cdbcriteria를 사용한 Custome 쿼리
'SELECT * FROM tbl_post where title LIKE %'.$title.'% ORDER BY title LIKE '.$title.' DESC , title LIKE '.$title.'% DESC'
업데이트 : 가 마침내 나는이 쓴 :
$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';
을하지만 내가 가진 오류 :
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
감사하지만 도움을주지 못함 –