active record help

for some reason when i try to update an active record

and want to change a field this case current players which defaults to (int)1.




$currentgroup=Groups::model()->findByPk('3');

$currentgroup->current_players='9';

$currentgroup->save();



the current_players field in the db is always 1, if i echo $currentgroup->current_players value is always 1,

what am i doing wrong??

So the value is not being assigned… Check your model’s rules. “current_players” should be a safe attribute (or must have some rule, e.g. “required”).

and also check the beforeSave() function (if it exists). Who knows you forgot to validate the insert or update scenario…