Yii Model Delete
<?php
$model=User::model()->findByPk($id);
if($model){
$model->delete();
}
# OR
$model=User::model()->deleteAll();
# OR
$model=User::model()->deleteAll(array("condition"=>"userid='$id'"));
# OR
$mode=User::model()->deleteAll("status='A'");
?>
Yii Model Update
<?php
$model=User::model()->updateByPk(
$ID,
array("status"=>'DECLINED')
);
# OR
$model=User::model()->updateAll(array(
'first_name'=>"$firstname",
'email'=>"$email"
),
"UserID=$id and status IS NULL "
);
# OR
$model=User::model()->updateAll(
array('status' => 1),
'UserID ='.$userid
);
?>
yii
Yii Model
27 de August de 2019
Yii
No Comments
adrianoApi
Yii Model Delete
Yii Model Update
yii