[eluser]Bainzy[/eluser]
hi again ben,
This still appears not to be working, here is my code for the fetchAllRows statement :
Code:
// Fetch all rows
function fetchAllRows($table) {
$query = $this->db->get($table);
if($query->num_rows()>0){
// Return result set as an associative array
return $query->result_array();
}
}
If i use the code that i originally posted then this works so the data is definately there, my database column names also match that of the code you posted and still nothing i am just getting the headers coming up no problem however the data is missing.
Is there something i am missing, i am also running the template library so sending values to my template is a little bit more awkward so i have made some minor adjustments to your code. Here is the code i have in my 'Home' Controller
Code:
// Lets create the content
$columns = array('forum', 'topics', 'posts', 'lastPost');
$this->table->set_heading($columns);
$rows = $this->HomeModel->fetchAllRows('topics');
foreach ($rows as $key => $row) {
foreach ($columns as $column) {
if (isset($row['$column'])) {
$data['$key'] = $row['$column'];
}
}
}
$data = array_values($data);
unset($rows);
$data['content'] = $this->table->generate($data);
$this->template->write_view('content', 'content_tpl', $data);