Welcome Guest, Not a member yet? Register   Sign In
how can I access database in a helper function ?
#7

[eluser]danmontgomery[/eluser]
get_instance() returns a copy of the codeigniter instance, you treat $CI like the controller object.

Code:
// In Controller
$this->load->model('my_model');
$this->my_model->my_function();

// Outside of controller
$CI =& get_instance();
$CI->load->model('my_model');
$CI->my_model->my_function();


Messages In This Thread
how can I access database in a helper function ? - by El Forum - 03-15-2010, 08:30 PM
how can I access database in a helper function ? - by El Forum - 03-16-2010, 12:15 AM
how can I access database in a helper function ? - by El Forum - 03-16-2010, 04:17 AM
how can I access database in a helper function ? - by El Forum - 03-16-2010, 12:43 PM
how can I access database in a helper function ? - by El Forum - 03-16-2010, 12:56 PM
how can I access database in a helper function ? - by El Forum - 03-16-2010, 12:59 PM
how can I access database in a helper function ? - by El Forum - 03-16-2010, 01:13 PM
how can I access database in a helper function ? - by El Forum - 03-16-2010, 01:26 PM
how can I access database in a helper function ? - by El Forum - 03-16-2010, 01:31 PM



Theme © iAndrew 2016 - Forum software by © MyBB