title: Codeigniter non-object model function
body: <p>My Model File:</p>
  
  <pre><code>Class productModel extends CI_Model{
  
    function __construct() {
      parent::__construct();
    }
    function getProduct() {
  
      $query =  $this-&gt;db-&gt;get('urunler');
      return $query-&gt;result();
    }
  }
  </code></pre>
  
  <p>Controller file:</p>
  
  <pre><code>class product extends CI_Controller {
  
  
    public function index()
    {
              $model= $this-&gt;load-&gt;model('productModel',NULL,TRUE);
              $data['urunListesi']=$model-&gt;getProduct();
  
      $this-&gt;load-&gt;view("site/header");
              $this-&gt;load-&gt;view("site/product",$data);
              $this-&gt;load-&gt;view("site/footer");
    }
  }
  </code></pre>
  
  <p>and view file:</p>
  
  <pre><code>foreach ($urunListele as $value) {
  
  
                           $adi=$value["adi"];
                           $fotolik= $value['fotolink'];
                           $kucukfot=$value["kucukfoto"];
                           $hakkinda = $value["hakkinda"];
  
                            echo "&lt;div class='portfolio-item logo animation col-md-3'&gt;";
                                    echo  "&lt;div class='portfolio-border'&gt;";
                                    //&lt;!-- Start Portfolio Item Thumb --&gt;
                                    echo "&lt;div class='portfolio-thumb'&gt;";
                                        echo "&lt;a class='lightbox' title='$hakkinda' href='$fotolik'&gt; ";
                                            echo "&lt;div class='thumb-overlay'&gt;&lt;i class='icon-resize-full'&gt;&lt;/i&gt;&lt;/div&gt;";
                                            echo "&lt;img alt='' src='$kucukfot' /&gt;";
                                        echo "&lt;/a&gt;";
                                    echo "&lt;/div&gt;";
  
                                   echo " &lt;div class='portfolio-details'&gt;";
  
                                            echo "&lt;h4&gt;";
                                            echo "&lt;p align='center'&gt;" . $value["adi"]. "&lt;/p&gt;";
                                            echo "&lt;/h4&gt;";
  
                                    echo "&lt;/div&gt;";
  
                                echo "&lt;/div&gt;";
                            echo "&lt;/div&gt;";
  }
  </code></pre>
  
  <p>And I have this error:</p>
  
  <pre><code>Fatal error: Call to a member function getProduct() on a non-object in C:\xampp\htdocs\ModaGabar\application\controllers\product.php on line 9
  </code></pre>
  
  <p>I do this also:</p>
  
  <pre><code>$autoload['libraries'] = array('database','session'); 
  </code></pre>