$criteria = new CDbCriteria; $criteria->condition = 'status=:status'; $criteria->params = array(':status' => 1); $criteria->order = 'create_time DESC'; $model = Post::model()->find($criteria);
$criteria = new CDbCriteria; $criteria->select = 'id, title'; $criteria->condition = 'status=:status'; $criteria->params = array(':status' => 1); $criteria->order = 'create_time DESC'; $criteria->limit = 10; $criteria->offset = 5; $model = Post::model()->findAll($criteria);This code creates a new instance of CDbCriteria and defines criteria to be used in a query to find a Post model. It also modifies the criteria object to limit the number of results to 10, starting from the 6th result. This is done by setting the limit and offset properties of the criteria object. Overall, CDbCriteria is a powerful tool in Yii for building and modifying criteria for database queries. It is included in the Yii core package library.