//assuming we have an instance of the `User` model $user = User::model()->findByPk(1); //to delete the user $user->delete();
$criteria = new CDbCriteria(); $criteria->addCondition('age > 30'); //to delete users with age greater than 30 User::model()->deleteAll($criteria);In this example, a `CDbCriteria` object is created to specify the condition of rows to be deleted. Then the `deleteAll()` method is called on the `User` model with the `CDbCriteria` object as a parameter to delete all users with age greater than 30. Overall, CActiveRecord delete method is an efficient way to delete rows from a database table in PHP.