$lastmonth= date('Y-m-d', strtotime('today - 30 days')); $today= date('Y-m-d'); $criteria = new CDbCriteria; $criteria->addCondition( "DATE_FORMAT(create_date, '%Y-%m-%d') >='$lastmonth' and DATE_FORMAT(create_date, '%Y-%m-%d') <= '$today'" ); $criteria->limit = 10; $criteria->order = 'total_view DESC'; //$criteria->group = 'id'; $modelvideo= Video::model()->findAll($criteria);
No comments:
Post a Comment