CodeIgniter Forums
Cannot load Model? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Cannot load Model? (/thread-42711.html)



Cannot load Model? - El Forum - 06-16-2011

[eluser]helloworld7[/eluser]
Hi. I've my web apps working on my pc using xampp. Then I upload to my hosting plan which is linux but then when I run a page I got this message.


An Error Was Encountered

Unable to locate the model you have specified: member

It seems it can load my library (myvalidation) fine but can't load any model.

My model name is Member.php (first letter upper case) and on my controller I've the following:

$this->load->Model('Member');
$this->Member->load($member_id);

Could it be some configuration I need to set on my hosting plan or codeigniter in order to load Model? I don't know where to go.

Any help will be appreciated. Thank you.


Cannot load Model? - El Forum - 06-16-2011

[eluser]marcogmonteiro[/eluser]
The model isn't inside any folder or something like that?

I don't see nothing wrong with your code..


Cannot load Model? - El Forum - 06-16-2011

[eluser]helloworld7[/eluser]
Yea it's inside the folder. It's not like one model having problem and it's all model I can't get it to load for some reason. I found it weird.

I'm wondering if there has something to do with apache? That's the only thing I can think of that's different between my local machine and the hosting. But it's just a shared hosting so I can't check any apache config. Sad

But maybe it shouldn't be that problem. Is there anything I can trigger to see my debug message that may help to resolve? Thank you.


Cannot load Model? - El Forum - 06-16-2011

[eluser]InsiteFX[/eluser]
Your problem is that your using upper case characters when they should all be lower case!
Code:
$this->load->model('member');
$this->member->load($member_id);

InsiteFX


Cannot load Model? - El Forum - 06-16-2011

[eluser]helloworld7[/eluser]
Really? But it worked on my own machine. I've the following.

$this->load->Model(‘Member’);
$this->Member->load($member_id);

It worked fine. I will give it a try but that sounds weird because it worked on my machine.


Cannot load Model? - El Forum - 06-16-2011

[eluser]helloworld7[/eluser]
Look at this on the section about loading.

http://ellislab.com/codeigniter/user-guide/general/models.html

It has this:

class Blog_controller extends CI_Controller {

function blog()
{
$this->load->model('Blog');

$data['query'] = $this->Blog->get_last_ten_entries();

$this->load->view('blog', $data);
}
}

It has UPPER CASE and worked on my machine then not on hosting. I will give it a try to change to lower case but if that works then I like to know why work on one place and not another. I think anyone would like to know too.


Cannot load Model? - El Forum - 06-16-2011

[eluser]bhumes[/eluser]
Windows is case insensitive. Linux is not.


Cannot load Model? - El Forum - 06-16-2011

[eluser]InsiteFX[/eluser]
When uploading to your server you should tell your ftp client to upload all lower case filenames!

InsiteFX


Cannot load Model? - El Forum - 06-17-2011

[eluser]marcogmonteiro[/eluser]
Yep InsiteFX is right. Always use Lowercase when loading stuff in general. Models, views, libraries etc etc...