[eluser]mflammia[/eluser]
This is probably so simple but I can not see anything wrong with my syntax looking up how it should be done in the help.
I get the following error 'Fatal error: Call to a member function get_records() on a non-object in'
The actual mysql query returns a result if I run it straight in myPHPadmin
Model is called site_model.php
Code:
class Site_model extends CI_Model {
function __construct()
{
// Call the Model constructor
parent::__construct();
}
function get_records()
{
$query = $this->db->query('SELECT * FROM person');
return $query->result();
}
}
Controller is called site.php
Code:
class Site extends CI_Controller {
function databaselist()
{
$data['query'] = $this->site_model->get_records();
$this->load->view('databaselist',$data);
}
}
Many thanks.