[eluser]jonhurlock[/eluser]
Hi all,
When I go to the following URL
http://mydomain.com/boats/index on mysite I get the following error:
Code:
Fatal error: Class 'CI_DB_result' not found in /the-path-to-my-directory/system/database/drivers/mysql/mysql_result.php on line 27
I can insert results in to my database. However, when I go to return results from the database, the error message above appears. Any help would be appreciated. I have included the relevant pieces of code below. I can't seem to see anything wrong with the code though, is my mysql_result.php file buggered?
Best,
Jon
Controller:boats.php
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Boats extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('boats_model');
}
public function index()
{
$data['title'] = 'Mumbles Fleet';
$data['boats'] = $this->boats_model->get_boats();
if (empty($data['boats']))
{
$this->load->view('template/header', $data);
$this->load->view('template/footer');
}
$this->load->view('template/header', $data);
$this->load->view('boat_management/show_boats', $data);
$this->load->view('template/footer');
}
}
Model:boats_model.php
Code:
<?php
class Boats_model extends CI_Model {
public function __construct()
{
$this->load->database();
}
public function get_boats($boat_id=FALSE)
{
if ($boat_id == FALSE)
{
$query = $this->db->get('boats');
return $query->result_array();
}
$query = $this->db->get_where('boats', array('id' => $boat_id));
return $query->row_array();
}
}
View:boat_management/show_boats.php
Code:
<?php foreach ($boats as $boat): ?>
<h2><?php echo $boat['name'] ?></h2>
<div id="main">
<?php echo $boat['type'] ?>(<?php echo $boat['row_type'] ?>)<br />
<?php echo $boat['description'] ?>
</div>
<?php endforeach ?>