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

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -