Codeigniter load model in helper : We can load model in helper using CI instance. It is very simple to use CI instance and load model in helper.
Here in this article we are going to explain how you can load model in helper using get_instance(). Let us understand how to load model in helper with simple example.
You can use below method to load models in library or helper.
Codeigniter load model in helper Syntax
$CI =& get_instance(); $CI->load->model('your_model_name'); $result = $CI->your_model_name->function_name();
Codeigniter load model in helper Example
Suppose we are loading the “Users” model and calling the model function “get_my_profile”
$CI =& get_instance(); $CI->load->model('Users'); $result = $CI->Users->get_my_profile();