0

I have set up a local copy of CodeIgniter and another copy on a linux machine. After installing both copies with my application, the local copy is running just fine but the linux version is showing the following error code:

Unable to locate the model you have specified: User_model

I have searched all day for the answer to this. I have tried to change the spelling on the name of the model, file name, everything that I can think of. What could i be missing that would display that error?

Thanks guys

Here is a copy of my code:

(user_model.php)

 <?php

class User_model extends CI_Model {
    public function __construct(){
        parent::__construct();
    }

    function runTest(){
        return "Testing";
    }
}
?>

(welcome.php)

class Welcome extends CI_Controller {
public function __construct(){
    parent::__construct();
}
public function index()
{
    $this->load->model('User_Model');
    $data['testing'] = $this->user1234->runTest();
    $this->load->view('welcome_message', $data);
}

}

3 Answers3

0

It is because of case sensitivity. First of all you should keep all file names in small letters ( user_model.php ) and then use that name in controller ( $this->load->model('user_model'); ) .

It must work.

0

Thank you guys for all the help. Apparently, it was a naming issues. I capitalized the filename, and in the controller and it now works just fine. Don't know what quiet happened with that. But thank you guys so much.

The new code looks like this:

$this->load->model('User_model');
$query = $this->User_model->validate();
0
     $this->load->model('User_Model');
    $data['testing'] = $this->user1234->runTest();
    $this->load->view('welcome_message', $data);

there is error in your second line change it to

$data['testing'] = $this->user_model->runTest();
Ijaz Ahmed Bhatti
  • 736
  • 1
  • 7
  • 26