Im tring to do a search by attributes, on a given date range and ordered by date created, but no luck.
$user = array('user_country'=>1 ,'user_gender'='M');
$rows = User::model()->findAllByAttributes($user,array("user_date_created BETWEEN '2012' AND '2013' " ,'order'=> 'user_date_created') );
Thank you in advance.
Had to use a CDbCriteria, like this:
$attribs = array('user_country'=>1 ,'user_gender'=>'M');
$criteria = new CDbCriteria(array('order'=>'user_date_created DESC','limit'=>10));
$criteria->addBetweenCondition('user_date_created', $date['date_start'], $date['date_end']);
$rows = user::model()->findAllByAttributes($attribs, $criteria);
Hope it helps somebody in the future
You can use to:
$criteria = new CDbCriteria;
$criteria->condition = "date_start >= '$date_start' AND date_end <= '$date_end'";
$model = TemporadaAlta::model()->find($criteria);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With