How to insert values into database using insert()

I am using a random string generator that would create a preliminary password for newly registered users. I was wondering how to insert the random generated string as a password in my database. any help would be greatly appreciated :D

NOTE: moved to proper section (General Discussion for Yii 1.1.x instead of Tips, Snippets and Tutorials)

How do you insert any other data?

You just assign the random string to the attribute you need and save it… like


$model->password = 'random string';

$model->save();