• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to locate the model you have specified error

#1
[eluser]Shannon[/eluser]
I am trying to make a login page from a tutorial. Whenever I submit the form, it says it can't locate the model I am trying to access.

membership_model.php
Code:
<?php

class Membership_model extends CI_Model {
    
    function validate() {
        $this->db->where('username', $this->input->post('username'));
        $this->db->where('password', md5($this->input->post('password')));
        $query = $this->db->get('lightpanel_login');
        
        if ($query->num_rows == 1) {
            return true;
        }
    }
}
?>

login.php
Code:
<?php

class Login extends CI_Controller {
    
    function __construct() {
        parent::__construct();
    }
    
    function index() {
        $data['main_content'] = 'login_form';
        $this->load->view('includes/template', $data);
    }
    
    function validate_credentials() {
        $this->load->model('membership_model');
        $query = $this->membership_model->validate();
        
        if($query)
        {
            $data = array(
                'username' => $this->input->post('username'),
                'is_logged_in' => true
            );
            
            $this->session->set_userdata($data);
            redirect('index/members_area');
        }
        
        else
        {
            $this->index();
        }
    }
}

?>

I can't really know how to explain it, so if you can ask me questions to try manipulate the problem I will be more than happy to answer them.

Also, today is my first day using CI.

Thanks,
Shannon.


Messages In This Thread
Unable to locate the model you have specified error - by El Forum - 07-23-2011, 11:11 PM
Unable to locate the model you have specified error - by El Forum - 07-23-2011, 11:47 PM
Unable to locate the model you have specified error - by El Forum - 07-23-2011, 11:49 PM
Unable to locate the model you have specified error - by El Forum - 07-24-2011, 12:02 AM
Unable to locate the model you have specified error - by El Forum - 07-24-2011, 12:05 AM
Unable to locate the model you have specified error - by El Forum - 07-24-2011, 12:09 AM
Unable to locate the model you have specified error - by El Forum - 07-24-2011, 12:33 AM
Unable to locate the model you have specified error - by El Forum - 07-24-2011, 01:17 AM
Unable to locate the model you have specified error - by El Forum - 07-24-2011, 02:40 AM
Unable to locate the model you have specified error - by El Forum - 07-24-2011, 03:04 AM
Unable to locate the model you have specified error - by El Forum - 07-24-2011, 03:15 AM
Unable to locate the model you have specified error - by El Forum - 07-24-2011, 03:58 AM
Unable to locate the model you have specified error - by El Forum - 07-24-2011, 10:30 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.