Welcome Guest, Not a member yet? Register   Sign In
Loading not working for models?
#1

[eluser]mattbman[/eluser]
I have just installed CI and for some reason, my models are not properly loading the libraries. Here is my code for my model:
Code:
class Usermodel extends Model {
    
    function Usermodel() {
        parent::Model();
    }
    
    function login() {
        if ($this->input->post('username') && $this->input->post('password')) {
            if ($this->checkpassword($this->input->post('username'),$this->input->post('password'))) {
                $this->session->set_userdata('username',$this->input->post('username'));
            }
        }
        
    }
    
    function logoff() {
        $this->session->unset_userdata('username');
    }
    
    function checkpassword($username,$password) {
        $query = $this->db->query("SELECT * FROM users WHERE username='".$username."'");
        $obj = $query->result();
        $obj = $obj[0];
        if (md5($password)==$obj->password) {
            return TRUE;
        } else {
            return FALSE;
        }
        
    }

}
I need session and database, and I have tried the autoload, I have tried loading in the individual functions, and in the constructor and nothing seems to work. Is there something I am missing?
#2

[eluser]Thorpe Obazee[/eluser]
It should be accessible from there when you autoload it. Maybe you can paste how you autoloaded it?
#3

[eluser]mattbman[/eluser]
Nevermind, I got it working again.




Theme © iAndrew 2016 - Forum software by © MyBB