title: Display database table in CodeIgniter
body: <p>I am trying to display a table using <strong>CodeIgniter</strong>. I made a function to select all data from one table and display it using a foreach loop when the button is clicked. I am getting this error:</p>
  
  <pre><code>Fatal error: Call to undefined method CI_DB_mysql_driver::result() in C:\Xampp\htdocs\Auction\application\models\bidding_model.php on line 47
  </code></pre>
  
  <p>This is my controller page:</p>
  
  <pre><code>public function viewauction()
  {
      $this-&gt;load-&gt;model('bidding_model');
      $data['query'] = $this-&gt;bidding_model-&gt;viewauction();   
      $this-&gt;load-&gt;view('auction_view', $data);
  }
  </code></pre>
  
  <p>This is the model:</p>
  
  <pre><code>function viewauction()
  {
      $query =  $this-&gt;db-&gt;select('products'); 
      return $query-&gt;result();
  }
  </code></pre>
  
  <p>This is the view:</p>
  
  <pre><code>&lt;tbody&gt;
  &lt;?php foreach($query as $row): ?&gt;
  &lt;tr&gt;   
      &lt;td&gt;&lt;?php echo $row-&gt;product_id; ?&gt;&lt;/td&gt;
      &lt;td&gt;&lt;?php echo $row-&gt;auction_id; ?&gt;&lt;/td&gt;
      &lt;td&gt;&lt;?php echo $row-&gt;start_time; ?&gt;&lt;/td&gt;
      &lt;td&gt;&lt;?php echo $row-&gt;end_time; ?&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;?php endforeach; ?&gt;
  &lt;/tbody&gt;
  </code></pre>