I am using codeigniter and handing admin side and users side separately. now i have model which is in admin folder and i want to call in controller of users. but when i am trying to load model from admin folder
$this->load->model('admin/myinterest_model');
$data['myInterest'] = $this->myinterest_model->selectResult('user', $this->session->userdata['Id']);
it shows following error
Message: Undefined property: Users::$myinterest_model
Filename: controllers/users.php
Please guide me how to load model from admin
try this call constructor in controller and load model into it
function __construct()
{
// Initialization of class
parent::__construct();
// load the model
$this->load->model('admin/myinterest_model');
}
create a folder inside your models folder (application/models/admin) and put your admin files in there (Myinterest_model.php)
now in your controller just call your model
$this->load->model('admin/myinterest_model');
$this->load->model('admin/myinterest_model' , 'myinterest');
The second parameter (optional) is used to call the method.
ex:
$this->myinterest->get_users();