title: Call to a member function num_rows() on a non-object in model file
body: <p>This is my code in model..</p>
  
  <pre><code>function get_info($product_id)
  {
      $this-&gt;db-&gt;from('product');
      $this-&gt;db-&gt;where('product_id',$product_id);
  
      $query = $this-&gt;db-&gt;get();
  
      if($query-&gt;num_rows()==1)
      {
          return $query-&gt;row();
      }
  </code></pre>
  
  <p>So many questions on stackoverflow but I Dont found any answer related to scenario. So what I am doing wrong??</p>