我有带有ID的数组,并希望通过id删除它们
$membersId = array('1','2','3'); $inStatement = implode(',',$membersId); //dont work! TRatingMembers::model()->deleteAll(array('member_id IN (:member_id)'),array(':member_id' => $inStatement));
如何用一个事务删除所有行?
$criteria = new CDbCriteria; $criteria->addInCondition('member_id',$membersId); TRatingMembers::model()->deleteAll($criteria);
http://www.yiiframework.com/doc/api/1.1/CDbCriteria#addInCondition-detail