title: CodeIgniter adding session variable to an already defined "named session"
body: <p>I already created as session named "verified" as shown below (in my login controller):</p>
  
  <pre><code>foreach($result as $row)
  {
    $sess_array = array(
         'id' =&gt; $row-&gt;memberid, //Session field: id.
         'username' =&gt; $row-&gt;member_userunique //Session field: username.
    );
    // Create a session with a name verified, with the content from the array above.
    $this-&gt;session-&gt;set_userdata('verified', $sess_array);
  }
  </code></pre>
  
  <p>Now, when a user open a page called book (with a controller named book) i want to add one more additional variable called "book_id" to my "verified" session.</p>
  
  <p>This is what i have done</p>
  
  <pre><code>function index()
  {
     //Add a new varible called book_id
     $this-&gt;session-&gt;set_userdata('book_id', $titleID);
  }
  </code></pre>
  
  <p>When i tried to retrieve the 'book_id' using the following method:</p>
  
  <pre><code>    $session_data = $this-&gt;session-&gt;userdata('verified');
      $article_id = $session_data['book_id'];
      $user_id = $session_data['id'];
  </code></pre>
  
  <p>It only able to retrieve the 'id' however the 'book_id' is not defined. But if do a var_dump() on $this->session->all_userdata() i can see that the 'book_id' session variable has been successfully appended.</p>
  
  <p>After reading the CI documentation about session, i realized that the code above will not work as i have not tell it to which session should i add the variable to.</p>
  
  <p>Can anyone point me to the right direction?</p>