saving user session

Hi, from the very start, i’ve been using the built-in mechanism of Yii to store user data in persistent storage.

now my problem is, I need to store the session data of currently logged-in user in a table field, How will I do that? , when I logged in and have this $_SESSION vardumped, it returns null or even by using the print_r

Take a look to CDbHttpSession.

If your session is empty, it means that you didn’t saved anything in the session.

You can use CDbHttpSession to store sessions in the database.

In your config file simply add:




'components'=>array(

   ...

   'session'=>array(

      'class'=>'CDbHttpSession',

      'connectionID'=>'db', //name of your database connection

   ),

   ...

),