Welcome Guest, Not a member yet? Register   Sign In
Call to undefined method Site_model::userd() I do not get it
#1

[eluser]Michal1[/eluser]
Hey guys,

I have a problem with function in site controller. I am inserting a data into database and I have an easy function in my controller

Code:
function create_user()
                {
                    $users = array(
                        'username'=>$this->input->post('username'),
                        'password'=>$this->input->post('password')
                    
                    );
                    
                    $this->site_model->userd($users);
                    
                }

Then I have model: site_model and inside

Code:
function userd($users)
        {
            $this->db->insert('users,$users');
            return;
            
        }


Then when I enter data into inputs and click on submit in my view I get this:

Code:
Fatal error: Call to undefined method Site_model::userd() in........

Why? Everything seems fine to me in the code.

Thank you
#2

[eluser]Bart v B[/eluser]
Did you also load the model in the controller?
some thing like $this->load->model('site_model');

Code:
function userd($users)
{
     $this->db->insert('users',$users);
     return;
            
}
#3

[eluser]Michal1[/eluser]
I load all models automatically in autoload.php
#4

[eluser]Ivar89[/eluser]
I don't really see a problem neither, did you check uppercase and lowercase for nameing files and calling them?




Theme © iAndrew 2016 - Forum software by © MyBB