[eluser]cryogenix[/eluser]
pls don't! otherwise don't use CI instead... if you really designed your models that badly, then take the time to fix it. you'll have easier times in the long run.
sample model:
Code:
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
class Demo_model extends CI_Model
{
function __construct()
{
parent::__construct();
$this->load->database();
$this->table = 'tbl_something';
}
function get_something($id)
{
$query = $this->db->get_where($this->table, array('id' => $id));
return $query;
}
}
/* End of file demo_model.php */
/* Location: ./application/models/demo_model.php */
sample controller:
Code:
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
class Something extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('demo_model', 'demo');
}
function index()
{
$result = $this->demo->get_something(1);
$orders = $result->query();
foreach($orders as $order)
{
//do something with the orders and store them to some $processed_result variable
}
$data['something'] = $processed_results;
$this->load->('some_view', $data);
}
}
/* End of file something.php */
/* Location: ./application/controllers/something.php */
sample view:
Code:
<div>
<p><?php echo $something->column1; ?></p>
<p><?php echo $something->column2; ?></p>
</div>