$model->save() not saving record

I have a single model "Mobile" generated by CRUD. It is not related to any other.

In the controller (Generated by CRUD), in the update action , i just wanted to update a single filed when some one click on update link.

i have changed mu update action as bellow

public function actionUpdate($id) {

$model=$this->loadModel($id);

$model->cug_status=‘Provisioned’;

$model->save();

$this->redirect(…);

}

But this is not updating my record, how can i know where is the problem ?

i tried echo all model attributes like :

echo $model->id

echo $model->cug_status

echo $model->mobile_no etc etc all are showing correct values, why save() is not updating my record ?

Regards

no any error shown??

No Error is shown, i have also enabled logging.

But if i use

if($model->save())

The if condition returns false.

Use $model->save(false)

If that works that means that some validation rule fails

1 Like

Thanx That is correct problem

That just means that you saved your data without first validating it… so you have to check your validation rules to see what is happening there…