[eluser]cb951303[/eluser]
[quote author="stuffradio" date="1220842397"]No you need to take a look at Models.
In a model it is really easy to get results from a Database. For what you are doing this is what you do.
Controller:
Code:
<?php
class Mycontroller extends Controller
{
function Mycontroller()
{
parent::Controller();
$this->load->library('database');
$this->load->model('Mymodel');
}
function index()
{
$layout['list'] = $this->Mymodel->listResults();
$this->load->view('header');
$this->load->view('main', $layout);
$this->load->view('footer');
}
}
Model:
Code:
<?php
class Mymodel extends Model
{
function Mymodel()
{
parent::Model();
}
function listResults()
{
$query = $this->db->get('table');
return $query->result();
}
}
View:
Code:
<h1>Results</h1>
<?php foreach($list as $result): ?>
<?php echo $result->field . '<br />'; ?>
I hope this helps you better understand what to do
[/quote]
Actualy I'm fully aware of models and MVC design criteria. but what I 'm asking has nothing to do with models. my listResults function uses CI HTML table class to create a table. it ofcourse gets its content via a model but as I said earlier it has nothing to do with the original question. thanks anyway