[eluser]jleequeen[/eluser]
I can't for the life of me figure out why I keep getting the following error:
Quote:A Database Error Occurred
Error Number: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'distribution_lines' at line 1
distribution_lines
Below is my code. Any ideas from anyone would be great!
My controller:
Code:
class Report extends Controller {
function Report() {
parent::Controller();
}
function view() {
$this->load->model('water_systems_model');
$this->load->model('distribution_lines_model');
$this->load->helper('form');
$pwsid = $this->session->userdata('pwsid');
$year = $this->session->userdata('year');
$data['water_system'] = $this->water_systems_model->water_system_info($pwsid);
$data['distribution_lines'] = $this->distribution_lines_model->get_distribution_lines($pwsid, $year);
$data['bodyid'] = 'plan';
$this->load->view('report/view', $data);
}
}
My Model:
Code:
class Distribution_lines_model extends Model {
function Distribution_lines_model() {
parent::Model();
}
function get_distribution_lines($pwsid, $year) {
$this->db->where('pwsid', $pwsid);
$this->db->where('year', $year);
$this->db->order_by('type', 'asc');
$query = $this->db->query('distribution_lines');
return $query->result();
}
}
My View:
Code:
....
<?php foreach($distribution_lines as $row) { ?>
<tr>
<td class="left"><?php echo $row->type; ?></td>
<td><?php echo $row->size; ?></td>
<td><?php echo number_format($row->percent,2); ?> %</td>
</tr>
<?php } ?>
....