六 删除的方法
1.Post::model()->deleteAll($condition,$params);
$count = Admin::model()->deleteAll('username=:name and password=:pass',array(':name'=>'admin',':pass'=>'admin'));
$id=1,2,3
deleteAll('id in ('.$id.')'); //删除id为这些的数据
if($count>0){
echo 'delete success';
}else{
echo 'delete fail';
}
2.Post::model()->deleteByPk($pk,$condition,$params);
$count = Admin::model()->deleteByPk(1);
$count = Admin::model()->deleteByPk(array(1,2),'username=:name',array(':name'=>'admin'));
if($count>0){
echo 'update success';
}else{
echo 'update fail';
}