I want update one attribute like ‘status’,in controller:
public function actionPublic()
{
$model=$this->loadModel();
//now status = 2;
$model->status = 1;
$model->save();
}
public function loadModel()
{
if($this->_model===null)
{
if(isset($_GET['id']))
$this->_model=Question::model()->findbyPk($_GET['id']);
if($this->_model===null)
throw new CHttpException(404,'The requested page does not exist.');
}
return $this->_model;
}
when i run action public,but the status value always is 2,not change to 1,please tell me what’s wrong.
Thank you very much!