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
Post a Comment