Welcome Guest, Not a member yet? Register   Sign In
Models aren't loading - why is that?
#1

[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 Sad

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?


Messages In This Thread
Models aren't loading - why is that? - by El Forum - 01-08-2008, 03:00 PM
Models aren't loading - why is that? - by El Forum - 01-08-2008, 03:20 PM
Models aren't loading - why is that? - by El Forum - 01-08-2008, 11:46 PM
Models aren't loading - why is that? - by El Forum - 01-09-2008, 12:07 AM
Models aren't loading - why is that? - by El Forum - 01-09-2008, 01:58 AM
Models aren't loading - why is that? - by El Forum - 01-09-2008, 09:58 AM
Models aren't loading - why is that? - by El Forum - 01-09-2008, 01:43 PM
Models aren't loading - why is that? - by El Forum - 01-09-2008, 02:15 PM
Models aren't loading - why is that? - by El Forum - 01-09-2008, 02:23 PM



Theme © iAndrew 2016 - Forum software by © MyBB