title: Codeigniter userdata session is empty
body: <p>When I set the session using set_userdata and check that at the other page, everything is setted well excepting userdata...
  I use <code>var_dump($this-&gt;session-&gt;all_userdata());</code> and code says</p>
  
  <blockquote>
    <p>array(5) { ["session_id"]=> string(32) "7195e5aea1695762492bf85d44112120" ["ip_address"]=> string(13) "xxx.xxx.x.xxx" ["user_agent"]=> string(120) "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.3" ["last_activity"]=> int(1414848680) ["user_data"]=> string(0) "" }</p>
  </blockquote>
  
  <p>user_data part is empty.</p>
  
  <p>Here is my code
  (application/controllers/login.php)</p>
  
  <pre><code>class Login extends CI_Controller {
      function index(){
          $this-&gt;load-&gt;model('Join_model');
          $this-&gt;load-&gt;view('head');
          if($this-&gt;input-&gt;post('id')){
              $data = $this-&gt;Join_model-&gt;gets(array(
                 'table'=&gt;'acc_wait_tb',
                 'id'=&gt;$this-&gt;input-&gt;post('id'),
                 'password'=&gt;$this-&gt;input-&gt;post('password'),
              ));
              if($data == true){
                  $dd = $this-&gt;db-&gt;get_where('acc_wait_tb', array('id'=&gt;$this-&gt;input-&gt;post('id')))-&gt;row();
                  $new_data = array(
                      'user_id'=&gt;$dd-&gt;id,
                      'name'=&gt;$dd-&gt;name,
                      'email'=&gt;$dd-&gt;email,
                  );
                  $this-&gt;session-&gt;set_userdata($new_data);
                  echo "&lt;script&gt;
                      location.href='/index.php/main';
                      &lt;/script&gt;";
              }else if($data == false){
                  echo "&lt;script&gt;alert('Login Fail.');&lt;/script&gt;";
                  $this-&gt;load-&gt;view('log_main');
                  $this-&gt;load-&gt;view('footer');
              }
          }else{
              $this-&gt;load-&gt;view('log_main');
              $this-&gt;load-&gt;view('footer');
          }
      }
  }
  </code></pre>
  
  <p>and application/views/nav.php</p>
  
  <pre><code>var_dump($data);
  $user_id = $this-&gt;session-&gt;userdata('user_id');?&gt;
  &lt;?php if($user_id != ""): ?&gt;
  &lt;p class="navbar-text pull-right" style="margin-right:30px;"&gt;Hi,
    &lt;a class="navbar-link" href=""&gt;&lt;?=$this-&gt;session-&gt;userdata('name')?&gt;&lt;/a&gt;
  &lt;/p&gt;
  &lt;?endif;?&gt;
  </code></pre>
  
  <p>and application/config/config.php</p>
  
  <pre><code>$config['encryption_key'] = 'asdfqwerertydfghcvbnsdfgqwerxcvb';
  
  /*
  |--------------------------------------------------------------------------
  | Session Variables
  |--------------------------------------------------------------------------
  |
  | 'sess_cookie_name'    = the name you want for the cookie
  | 'sess_expiration'     = the number of SECONDS you want the session to last.
  |   by default sessions last 7200 seconds (two hours).  Set to zero for no expiration.
  | 'sess_expire_on_close'  = Whether to cause the session to expire automatically
  |   when the browser window is closed
  | 'sess_encrypt_cookie'   = Whether to encrypt the cookie
  | 'sess_use_database'   = Whether to save the session data to a database
  | 'sess_table_name'     = The name of the session database table
  | 'sess_match_ip'     = Whether to match the user's IP address when reading the session data
  | 'sess_match_useragent'  = Whether to match the User Agent when reading the session data
  | 'sess_time_to_update'   = how many seconds between CI refreshing Session Information
  |
  */
  $config['sess_cookie_name']   = 'ci_session';
  $config['sess_expiration']    = 7200;
  $config['sess_expire_on_close'] = FALSE;
  $config['sess_encrypt_cookie']  = TRUE;
  $config['sess_use_database']  = TRUE;
  $config['sess_table_name']    = 'ci_sessions';
  $config['sess_match_ip']    = FALSE;
  $config['sess_match_useragent'] = FALSE;
  $config['sess_time_to_update']  = 300;
  
  /*
  |--------------------------------------------------------------------------
  | Cookie Related Variables
  |--------------------------------------------------------------------------
  |
  | 'cookie_prefix' = Set a prefix if you need to avoid collisions
  | 'cookie_domain' = Set to .your-domain.com for site-wide cookies
  | 'cookie_path'   =  Typically will be a forward slash
  | 'cookie_secure' =  Cookies will only be set if a secure HTTPS connection exists.
  |
  */
  $config['cookie_prefix']  = "";
  $config['cookie_domain']  = "";
  $config['cookie_path']    = "/";
  $config['cookie_secure']  = TRUE
  </code></pre>
  
  <p>Please! help me! This error makes me crazy! Please...!
  (I try to solve this calling userdata in controller and send data to the view using <code>$this-&gt;load-&gt;view('nav.php',$data);</code> But it didn't work...)</p>