/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Ocompra(); $model->valorespordefecto(); // Uncomment the following line if AJAX validation is needed $this->performAjaxValidation($model); if (isset($_POST['Ocompra'])) { $model->attributes = $_POST['Ocompra']; if ($model->save()) { $command = Yii::app()->db->createCommand(" delete from " . Yii::app()->params['prefijo'] . "docompra_t where idsesion=" . Yii::app()->user->getId()); $command->execute(); $this->redirect(array('update', 'id' => $model->idguia)); } } $this->render('create', array('model' => $model)); }