[eluser]alwaystyred[/eluser]
Hi, I am trying to create a 2-D array containing details of the tables and the fields within those tables. This is the code in my controller:
Code:
$this->view_data['tables'] = $this->db->list_tables();
foreach ($this->view_data['tables'] as $table) {
$this->view_data['tables']['fields'] = $this->db->list_fields($table);
}
This works fine for the tables, I am able to get all of those in the view, but it only returns the field details of the last table it queries.
The code in the view is:
Code:
foreach ($tables as $table) {
echo '<p class="head">' .$table . '</p>';
echo '<div class="body">';
foreach ($tables['fields'] as $field) {
echo '<input type="checkbox" name="field" value="' . $table . '.' . $field .'" />' . $field . '<br />';
}
echo '</div>';
}
Thanks for help in advance, if you need more info, I'm happy to provide