[eluser]lkoreality[/eluser]
I'm getting an undefined variable: data in my controller and an undefined variable: query in my view.
My database should be loading automatically. This is the code in my view file that's causing the problem:
Code:
<? foreach ($query->result() as $sub): ?>
<?=$sub->function; ?>
<? endforeach; ?>
I'm loading a model:
Code:
<?php
class Links extends Model {
function __controller()
{
parent::Link();
}
function get_db()
{
$query = $this->db->query('SELECT * FROM page');
$data['query'] = $this->Links->get_db();
}
}
to my controller. I'm using this code:
Code:
$this->load->model('Links');
I tried placing it both in the construct and a function of my controller. I'm loading the data file into a view file.
Any ideas?