php - CDb criteria conditions -


how make following sql condition in cdbcriteria

$dbcommand = yii::app()->db->createcommand("select * offer_events enddate >= '$now' , title '%$locationdet%' , description '%$locationdet%' order id desc "); 

you try doing:

$criteria = new cdbcriteria(); $criteria->condition = 'enddate >=:enddate , title :title , description :description'; $criteria->params = array(     ':enddate'=>$enddate,      ':title'=> '%' . $title . '%',      ':description' => '%' . $description .'%' ); $criteria->order = 'id desc'; $model = somemodel::model()->find($criteria); 

Comments

Popular posts from this blog

Upgrade php version of xampp not success -

amazon web services - S3 and apache mod_proxy with basic authentication -

powershell - This solution contains one or more assemblies targeted for the global assembly cache -