-4

当我需要更新时,我会收到这个答案。我该做什么?

public function actionUpdate($id)
{       
    if(isset($_POST['submit']))
    {
        $recruit = Recruit::model()->findByPk($_POST['pid']);
        $recruit->title = $_POST['title'];
        $test->save();
            $this->redirect(array('admin','id'=>$id));              
    }

    $this->render('update',array(
        'model'=>$this->loadModel($_POST['pid']),
        'id'=>$id,
        'pid'=>$_POST['pid'],
    ));
}
4

1 回答 1

6

没有$test创建类实例,我认为您必须使用$recruit

 $test->save();
 //to
 $recruit->save();
于 2012-06-07T06:49:49.863 回答