[eluser]bigtony[/eluser]
Personally I use Active Record for the database stuff, so in your model you'll have something like this...
Code:
function load_all() {
$this->db->from('tablename');
return $this->db->get();
}
Then your controller can get the data from the model and pass it to the view...
Code:
$this->load->model('tablename_model')
$tablename_query = $this->tablename_model->load_all();
$view_data['tablename_query'] = $tablename_query;
$this->load->view('pagename_view', $view_data);
Then in your view you can loop through the resultset like this...
Code:
<div id="sidebar">
<?php foreach ($tablename_query->result() as $row_of_data): ?>
<div class="sideitem">
<h3><?php echo $row_of_data->column_name; ?></h3>
</div>
<?php endforeach; ?>
</div>
or using an associative array...
Code:
<div id="sidebar">
<?php foreach ($tablename_query->result_array() as $row_of_data): ?>
<div class="sideitem">
<h3><?php echo $row_of_data['column_name']; ?></h3>
</div>
<?php endforeach; ?>
</div>