public function actionMylist() { if (false) { $this->redirect(Yii::app()->baseUrl . '/login'); } $msgInfo = "none"; $msgError = "none"; if (!empty($_POST) && $_POST['action'] == "create") { //if(AccountInfrastructure::model()->findByAttributes(array(''=>$_REQUEST['infraname'])) $newinfra = new Infrastructure(); $newinfra->Name = $_POST['infraname']; $newinfra->Device = 1; if ($newinfra->save()) { $newAcctInfra = new AccountInfrastructure(); $newAcctInfra->Account_Id = Yii::app()->user->getId(); $newAcctInfra->Infrastructure_Id = $newinfra->Id; $newAcctInfra->IsOnwer = 1; if ($newAcctInfra->save()) { $msgInfo = "Create the Infrastructure Successfully"; } else { print_r($newAcctInfra->errors); } } else { print_r($newinfra->errors); } } $myaccount = Account::model()->findByPk(Yii::app()->user->getId()); $this->renderPartial('mylist', array('msgError' => $msgError, 'msgInfo' => $msgInfo, 'infralist' => $myaccount)); }