title: Call to a member function get_posts() on a non-object
body: <p>I'm new to codeIgniter. I have the problem saying that Fatal error: Call to a member function get_posts() on a non-object in C:\xampp\htdocs\ci_series_5\application\controllers\posts.php on line 12</p>
  
  <p>
  
  <pre><code>class Posts extends CI_Controller{
  
      function _construct(){
          parent::_construct();
          $this-&gt;load-&gt;model('post');
  
      }
  
      function index(){
          $data['posts']=$this-&gt;post-&gt;get_posts();         line 12
          $this-&gt;load-&gt;view('post_index',$data);
      }
  </code></pre>
  
  <p>Post.php in model is below</p>
  
  <p>
  
  <pre><code>class Post extends CI_Model{
  
      function get_posts($num=20,$start=0){           
          $this-&gt;db-&gt;select()-&gt;from('posts')
          -&gt;where('active',1)-&gt;order_by('date_added', 'desc')
          -&gt;limit($num,$start);
          $query=$this-&gt;db-&gt;get();
          return $query-&gt;result_array();
      }
  
      function get_post($postID){
          $this-&gt;db-&gt;select()-&gt;from('posts')-&gt;where(array('active'=&gt;1,
          'postID'=&gt;$postID))-&gt;order_by('date_added','desc');
          $query=$this-&gt;db-&gt;get();
          return $query-&gt;first_row('array');
      }
  </code></pre>