title: php codeigniter single function for all other function
body: <p>here is some details for my question.  </p>
  
  <pre><code>controller:  
  function get_info()  
  {  
  $user_id = $this-&gt;session-&gt;userdata['logged_in']['userid']
  $this-&gt;load-&gt;model('message_model');  
  $msg_data['msg']=$this-&gt;message_model-&gt;get_user_msg($user_id); 
  $this-&gt;load-&gt;view('header',$msg_data);  
  $this-&gt;load-&gt;view('content');  
  $this-&gt;load-&gt;view('footer');     
  }  
  
  function others_goes_here()  
  {  
  $user_id = $this-&gt;session-&gt;userdata['logged_in']['userid']
  $this-&gt;load-&gt;model('message_model');  
  $msg_data['msg']=$this-&gt;message_model-&gt;get_user_msg($user_id); 
  LOAD OTHER VIEWS.....    
  }
  model:
  function get_user_msg($user_id)
  {
  QUERY GOES HERE......
  }  
  </code></pre>
  
  <p>Now what i want to achieve is how can i make the get_user_msg to be called only once without calling it to all my other functions.  Hope you guys can help me with this,<br>
  thank in advance.</p>