[eluser]yarek[/eluser]
Hello. I know, I know... it was discussed so many times, I searched the forums but nothing helped. Problem: "Call to a member function on a non-object in C:\http\cms\system\application\models\entry.php on line 17"
Here is my code:
cms.php
Code:
<?php
class Cms extends Controller {
function Cms() {
parent::Controller();
$this->load->model('Entry');
}
function index() {
$data['entries'] = $this->Entry->getAllEntries();
}
function entry($id) {
$data['entry'] = $this->Entry->getEntry($id);
}
}
?>
entry.php
Code:
<?php
class Entry extends Model {
function Entry() {
parent::Model();
}
function getEntry($id) {
$this->db->where('id', $id);
$query = $this->db->get('entries');
return $query->result();
}
function getAllEntries() {
$this->db->orderby('modified', 'desc');
$query = $this->db->get('entries');
return $query->result();
}
}
?>
I tried everything, I changed all names to lowercase etc and it didn't work. I tried model('', TRUE); and it didn't help me too
And what is interesting: it sees problem on the 17th line! There is a similliar function on 11th line and it doesn't see that. Strange?