title: Fix Error Codeigniter : Call to a member function pilihkat() on a non-object
body: <p>Error :</p>
  
  <p>A PHP Error was encountered</p>
  
  <p>Severity: Notice</p>
  
  <p>Message: Undefined property: CI_DB_mysqli_result::$Input_model</p>
  
  <p>Filename: controllers/Input_App.php</p>
  
  <p>Line Number: 18</p>
  
  <p>Backtrace:</p>
  
  <p>File: C:\xampp\htdocs\admin_app\application\controllers\Input_App.php
  Line: 18
  Function: _error_handler</p>
  
  <p>File: C:\xampp\htdocs\admin_app\index.php
  Line: 315
  Function: require_once</p>
  
  <p><strong>and</strong></p>
  
  <p>Fatal error: Call to a member function pilihkat() on a non-object in C:\xampp\htdocs\admin_app\application\controllers\Input_App.php on line 18</p>
  
  <p>My controller</p>
  
  <pre><code>    class Input_App extends CI_Controller {
  
  public function __construct()
  {
      parent::__construct();
      $this-&gt;load-&gt;helper('url');                    
      $this-&gt;load-&gt;model('Input_model','input_app'); 
  }
  
  public function index()
  {
      $this-&gt;db-&gt;from('referensi_kategori');
      $query = $this-&gt;db-&gt;get();
  
      $load['pilihkategori'] = $query-&gt;Input_model-&gt;pilihkat()-&gt;result();
  
      $this-&gt;load-&gt;view('input_view',$load);
  }
  </code></pre>
  
  <p>Model (pilihkat())</p>
  
  <pre><code>        public function pilihkat(){
      $this-&gt;db-&gt;select('*');    
      $this-&gt;db-&gt;join('referensi_kategori','referensi_kategori.id_kategori = data_aplikasi.id_kategori','left');
      $query = $this-&gt;db-&gt;get();
  
      return $query-&gt;result();
  }
  </code></pre>
  
  <p>View (Select dropdown from data_kategori)</p>
  
  <pre><code>    &lt;tr&gt;
                                          &lt;td&gt;Kategori&lt;/td&gt;
                                          &lt;td&gt;&lt;select name="data_kategori" class="form-control"required id="data_kategori" style="width:85%;"&gt;
                                          &lt;option value='0'&gt;-- pilih kategori --&lt;/option&gt;
                                              &lt;?php foreach ($pilihkategori as $kat) {
                                                  echo "&lt;option value=".$kat-&gt;id_kategori."&gt;".$kat-&gt;data_kategori."&lt;/option&gt;";
                                              }?&gt;
                                          &lt;/select&gt;&lt;/td&gt;
                                      &lt;/tr&gt;
  </code></pre>
  
  <p>How to fix this error ? </p>