Cannot Update Data When Using Confirm Password

In the registration form, used password field and confirm password field. After using this data cannot be updated.

Model


public function rules()

	{

		// NOTE: you should only define rules for those attributes that

		return array(

			array('name, password', 'required'),

                        array('password', 'compare', 'compareAttribute'=>'confirm_password'), 

			array('name', 'length', 'max'=>55),

			// The following rule is used by search().

			// Please remove those attributes that should not be searched.

			array('id, name', 'safe', 'on'=>'search'),

		);

	}

Trying to update user model from index.php




$post= User::model()->findByPk(1);

$post->name='Abcdef';

$post->password='newpassword';

$post->save(); 



The new data not updated? when it solve?

Are you not hashing the password before saving ?? use $post->update() instead of $post->save()

may be you have any validation rules on other user model attributes. if so, only to validate username and password, use $post->save(true, array(‘attr1’,‘attr2’))

else you can stop validation on updating by folllwing. $post->save(false);

class reference - http://www.yiiframework.com/doc/api/1.1/CActiveRecord/#save-detail