title: CodeIgniter - Call to a member function model() on a non-object
body: <p>I have a login form that is being created in the view. Then in my controller I'm trying to load my model but it doesn't seem to load. Looked up a few answer here on stackoverflow and almost everybody says autoload model, import the database library,etc. I did that but I'm still getting the error</p>
  
  <pre><code>    Fatal error: Call to a member function model() on a non-object in C:\xampp\htdocs\\project\application\controllers\login.php on line 11 
  
      A PHP Error was encountered
  
      Severity: Notice
  
      Message: Undefined property: Login::$load
  
      Filename: controllers/login.php
  
      Line Number: 11
  </code></pre>
  
  <p><strong>login_view</strong></p>
  
  <pre><code>&lt;?php
      $loginEmail = array('placeholder' =&gt; "Email", 'name' =&gt; "loginEmail");
      $loginPassword = array('placeholder' =&gt; "Wachtwoord", 'name' =&gt; "loginPassword");
      $loginSubmit = array('name' =&gt; "loginSubmit", 'class' =&gt; "btn", 'value' =&gt; "Inloggen");
      $loginForgot = array('name' =&gt; "loginForgot", 'class' =&gt; "link", 'value' =&gt; "Wachtwoord vergeten?");
  
      echo form_open('login/login', array('class' =&gt; 'grid-100 formc'));
      echo form_input($loginEmail);
      echo form_password($loginPassword);
      echo form_submit($loginSubmit);
      echo form_submit($loginForgot);
  ?&gt;
  </code></pre>
  
  <p><strong>login_controller</strong></p>
  
  <pre><code>&lt;?php
  
  Class Login extends CI_Controller{
      function index(){
          $data['content'] = 'login_view';
          $this-&gt;load-&gt;view('templates/template', $data);
      }
  
  
      function login(){
          $this-&gt;load-&gt;model('login_model');
          $query = $this-&gt;login_model-&gt;validate();
  
          if($query){
              $data = array(
                  'username' =&gt; $this-&gt;input-&gt;post('loginEmail'),
                  'loggedin' =&gt; true
  
              );
  
              $this-&gt;session-&gt;set_userdata($data);
               redirect('profile/myprofile');
          }
      }
  
  }
  
  ?&gt;
  </code></pre>
  
  <p><strong>login_model</strong></p>
  
  <pre><code>&lt;?php
  
  Class Login_model extends CI_Model{
  
      function validate(){
          $this-&gt;db-&gt;where('email', $this-&gt;input-&gt;post('loginEmail'));
          $this-&gt;db-&gt;where('password', md5($this-&gt;input-&gt;post('loginPassword')));
  
          $query = $this-&gt;db-&gt;get('tbl_users');
  
          if($query-&gt;num_rows == 1){
              return true;
          }
      }
  
  }
  
  ?&gt;
  </code></pre>
  
  <p><strong>autoload.php</strong></p>
  
  <pre><code>$autoload['libraries'] = array('database', 'session');
  </code></pre>
  
  <p>What am I missing here?</p>