Yii Model


yii framework

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
            );

?>  


Moeda Tipo Valor
Dollar Compra R$ 5,59
Dollar Venda R$ 5,59
Data 06/06/2025

June 2025
S M T W T F S
1234567
891011121314
15161718192021
22232425262728
2930