title: CodeIgniter - Call to a member function select() on a non-object
body: <p>I'm quite new to CodeIgniter. This is my code:</p>
  
  <pre><code>class User_model extends CI_Model {
  
      function validate_user() {
  
          $this-&gt;db-&gt;select('*');
          $this-&gt;db-&gt;from('user');
          $this-&gt;db-&gt;where('username', $this-&gt;input-&gt;post('username'));
          $this-&gt;db-&gt;where('password', md5($this-&gt;input-&gt;post('password')));
          $validate_user = $this-&gt;db-&gt;get();
  
          if($validate_user-&gt;num_rows == 1) {
              return TRUE;
          }
      }
  }
  </code></pre>
  
  <p>I'm, receiving this error in my model file:</p>
  
  <pre><code>Call to a member function select() on a non-object
  </code></pre>
  
  <p>Currently I'm using CodeIgniter version 2.1.0. Please help me!</p>