title: codeigniter can't access session data in another controller
body: <p>I want to get data from database using session data as variable . The function is right I think, but it always give null as result. When I display it in view it gets nothing/<code>null</code>. Can anyone help me?</p>
  
  <p>Im defining this code in <code>login</code> controller :</p>
  
  <pre><code>$this-&gt;session-&gt;set_userdata('id_member', 'id_member');
  </code></pre>
  
  <p>function DataProfil in controller <code>c_perawat</code></p>
  
  <pre><code>public function DataProfil(){
          $session_id = $this-&gt;session-&gt;userdata('id_member');
          $data['klinik']=$this-&gt;m_klinik-&gt;GetDataKlinik($session_id)-&gt;result();
          $data['sidebar']='member/perawat/sidebar';
          $data['content']='member/perawat/pr';
          $this-&gt;load-&gt;view('member/perawat/main',$data);
  
      }
  </code></pre>
  
  <p>My model function</p>
  
  <pre><code>public function GetDataKlinik($session_id){
          $klinik=$this-&gt;db-&gt;query("SELECT * FROM klinik where id_perawat='$session_id'");
          return $klinik;
      }
  </code></pre>