I\'m getting an unable to locate model error.
$this->load->model(\'1/Gift_model\');
My model file name is gift_model.php
The problem is that your file name is all lowercase (gift_model.php
) while you are loading Gift_model
within CodeIgniter. Either change the file name to Gift_model.php
or update your code accordingly.
`if using codeignitor 3.1.3
every thing same otherwise showing error
class name => My_model
file name => My_model.php
load model => $this->load->model('My_model');
call function => $this->My_model->function();`
Are you calling the parent's constructor for the model?
class Gift_model extends CI_Model {
function __construct()
{
parent::__construct();
}
My_model
my_model
$this->load->model('my_model');
Starting with CodeIgniter 3.0, all class filenames (libraries, drivers, controllers and models) must be named in a Ucfirst-like manner or in other words - they must start with a capital letter.
(Source: CI docs)
-> Model Class name must be Uppercase
-> Model PHP file name must be Lowercase
-> Load Model using Lowercase(filename): $this->load->model('gift_model', TRUE);