Reputation: 1866
I am unable to get model file User_model.php
i have specified file in models/frontend/user_model.php
Declaration in user_model.php
<?php
class User_model extends CI_Model {}
I have user model in Controller :
<?php
class User_controller extends MY_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('frontend/user_model');
}
This is correctly working on my localhost but when i host on my domain it gives such type of errors.
Upvotes: 0
Views: 718
Reputation: 1938
Check for model name. Case sensitive name ignored in localhost
. But in server they are treated as different file. I can see your model name is user_model
. But Model class is User_model
which is in capital letter. Hope this help.
Upvotes: 0
Reputation: 970
Did you follow Codeigniter User Guide?
class User_model extends CI_Model {
function __construct()
{
parent::__construct();
}
}
Your file will be this:
application/models/user_model.php
If you use <?
as an opening tag (check at the very start of your file), change it to <?php
. The server might not allow the shorthand style.
And if you are still unlucky, try this:
$CI =&get_instance();
$CI->load->model('articles_model');
$parameter = $CI->articles_model>getarticle($id);
Upvotes: 0
Reputation: 1589
When making or calling a class you have to use first letter capital of class. Call your model like this.
$this->load->model('frontend/User_model');
I faced this issue too. We have to use first letter capital for classes in codigniter 3.0 or above.
Upvotes: 0
Reputation: 48
You need to rename your model file from user_model.php to User_model.php In windows wampp or xampp, case doesn't matter, but your production environment has got to be on linux and that is case sensitive, that's why you are getting the errors.
Upvotes: 1