database - Error causes password change while updating new data in Yii -


while i'm trying update aid field in database function:

static function aidinsert() {     $model = users::model()->findall();     foreach($model $m)     {         $code = alphabeticcode();         $aidk = users::model()->findbyattributes(array('aid'=>$code));         if(!empty($aidk))         {             $code = alphabeticcode();         }         $m->aid = $code;         $m->save();     } } 

(alphabeticcode method method used generate random strings.)

the whole user's password stored in password field changed piece of md5 hash, right after function completed.

did wrong?

using save() saves every attribute default - can specify attributes save:

$m->save(true, array('aid')); // true use validation, array specify attributes save 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -