$connection=Yii::app()->db;
$sql= "[b]UPDATE orders_temp SET jumlah = '".$jumlah[$i]."'
WHERE id_orders_temp = '".$id[$i]."'[/b]";
$command=$connection->createCommand($sql)->execute()
maksudnya simpan data Active Record pake transaction -> commit / rollback gitu gan ?
kalau memang iya, ini aku bagi contohnya
$model=Post::model();
$transaction=$model->dbConnection->beginTransaction();
try
{
// find and save are two steps which may be intervened by another request
// we therefore use a transaction to ensure consistency and integrity
$post=$model->findByPk(10);
$post->title='new post title';
$post->save();
$transaction->commit();
}
catch(Exception $e)
{
$transaction->rollBack();
}