title: codeigniter access model from library
body: <p>I am trying to integrate the following code into my project. it is held in a  library</p>
  
  <pre><code>function do_std_login($email, $password) {
      $CI =&amp; get_instance();
      $login = $CI-&gt;users_model-&gt;login($email, md5($password));
      if($login){
          $session_array = array(
              'user_id' =&gt; $login-&gt;user_id,
              'name' =&gt; $login-&gt;name,
              'type' =&gt; 'Standard'
          );
          $CI-&gt;session-&gt;set_userdata($session_array);
  
          // Update last login time
          $CI-&gt;users_model-&gt;update_user(array('last_login' =&gt; date('Y-m-d H:i:s', time())), $login-&gt;user_id);
  
          return true;
      } else {
          $this-&gt;errors[] = 'Wrong email address/password combination';
          return false;
      }
  }
  </code></pre>
  
  <p>I am calling it this way:</p>
  
  <pre><code>$login = $this-&gt;jaclogin-&gt;do_std_login($this-&gt;input-&gt;post('email'),$this-&gt;input-&gt;post('password'));
  </code></pre>
  
  <p>but when I run it I get the following error</p>
  
  <p>A PHP Error was encountered
  Severity: Notice
  Message: Undefined property: Login::$users_model
  Filename: libraries/jaclogin.php
  Line Number: 45</p>
  
  <p>I have check I am do load the correct library in the codeigniter autoload file. </p>
  
  <p>Any Ideas?</p>
  
  <p>Thanks</p>
  
  <p>Jamie Norman</p>