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?


Messages In This Thread
Loading not working for models? - by El Forum - 11-30-2008, 10:34 PM
Loading not working for models? - by El Forum - 11-30-2008, 11:11 PM
Loading not working for models? - by El Forum - 12-02-2008, 11:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB