Welcome Guest, Not a member yet? Register   Sign In
Getting an error when trying to run a 5 line Model
#1

[eluser]markanderson993[/eluser]
Hello I am having enormous difficulty creating the simplest of models. I keep getting this error when I test my page:

Code:
Fatal error: Class model_home: Cannot inherit from undefined class models in /.../system/application/models/model_name.php on line 3

I have no idea why! I'm copying and pasting the Model example code right out of Manual!

Here is my code:

model_name.php (in the application->models folder)
Code:
<?php

class Model_name extends Model {

    function Model_name()
    {
        parent::Model();
    }
}

?>

And here is the file I am calling it from: home.index (A controller named home.php)
Code:
<?php

class Home extends Controller {
    
    function Home() {
        parent::Controller();    
        $this->load->model('model_name');
        
    }
    
    function index() {
        $this->template->load('home/home.main');
        
    }
    
}

?>

Does anyone have any idea why this is happening?! If you do I would greatly appreciate your help! Thank you!

- Pianoman993
#2

[eluser]Ivan A. Zenteno[/eluser]
try to change name's model. name_model maybe
#3

[eluser]markanderson993[/eluser]
Ah! That helped since I had changed the name of the file rendering all following saves to be rendered useless! Fixed! Thanks very much. Your input helped me to discover the flaw Smile




Theme © iAndrew 2016 - Forum software by © MyBB