[eluser]raffie77[/eluser]
it's fixed.
this is my new code:
controler:
Code:
public function test() {
$this->load->model('get_DB');
$data['query'] = $this->get_DB->test();
$data['title'] = 'test';
$data['main_content'] = 'test';
$this->load->view("template", $data);
}
the model:
Code:
public function test() {
$query = $this->db->query("SELECT * FROM invoer ORDER BY datum DESC");
if($query->num_rows() > 0)
{
return $query;
}
}
the view:
Code:
<?php
$list_fields = $query->list_fields();
$records = $query->result();
echo '<table><tr>'; #begin table
foreach ($list_fields as $field) { #generate table headers
printf("<th>%s</th>\n", $field);
}
print('<th>Bewerken</th></tr>'); #exra table head and end table row
print('<tr>'); # start new row for table data
foreach ($records as $row) { #generate table data
foreach ($list_fields as $field) {
$output = $row->$field;
printf("<td>%s</td>\n", $output);
}
print('<td>Update | Del </td></tr>'); #the extra td (I'll create anchors for that ofcourse)
}
print('</table>');