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,97
Dollar Venda R$ 5,97
Data 22/01/2025

January 2025
S M T W T F S
 1234
567891011
12131415161718
19202122232425
262728293031