title: why I'm getting function get() on a non-object in error when using codeigniter?
body: <p>index_model.php is below:</p>
  
  <pre><code>&lt;?php
  class index_model extends CI_Model {
  
      function __construct() {
          parent::__construct();
      }
  
      function getVideo()
      {
          $query = $this-&gt;db-&gt;get('videolar');
          return $query-&gt;result_array();
      }
  
  }
  ?&gt;
  </code></pre>
  
  <p>And index controller is below, too</p>
  
  <pre><code>&lt;?php
  
  class index extends CI_Controller {
  
          function __construct() {
              parent::__construct();
          }
  
          function index()
      {
                  $this-&gt;load-&gt;model('index_model');
                  $data['video'] = $this-&gt;index_model-&gt;getVideo();
          $this-&gt;load-&gt;view('index',$data);
      }
  }
  ?&gt;
  </code></pre>
  
  <p>When I call index controller it returns this error</p>
  
  <blockquote>
    <p>Fatal error: Call to a member function get() on a non-object in
    /var/www/atlet/application/models/index_model.php on line 10</p>
  </blockquote>
  
  <p>I set database in autoload.php. </p>
  
  <blockquote>
    <p>$autoload['packages'] = array('database');</p>
  </blockquote>