Welcome Guest, Not a member yet? Register   Sign In
Using multiple databases with helper files
#6

[eluser]JoostV[/eluser]
Sorry, my bad. You CAN access the superobject from a helper. I just never do Smile
OK, then this will work. In your helper (just tested it):
Code:
function some_function ()
{
    $ci = & get_instance();
    $db1 = $ci->load->database('group_one', TRUE);
    $query = $db1->get('some_table');
    if ($query->num_rows() > 0) {
        return $query->result_array();
    }
}

[EDIT] Having said that, it's good MVC practise to do all data handling in your models. http://ellislab.com/codeigniter/user-gui...w/mvc.html


Messages In This Thread
Using multiple databases with helper files - by El Forum - 12-06-2009, 01:41 AM
Using multiple databases with helper files - by El Forum - 12-06-2009, 01:49 AM
Using multiple databases with helper files - by El Forum - 12-06-2009, 02:04 AM
Using multiple databases with helper files - by El Forum - 12-06-2009, 02:09 AM
Using multiple databases with helper files - by El Forum - 12-06-2009, 02:12 AM
Using multiple databases with helper files - by El Forum - 12-06-2009, 02:29 AM
Using multiple databases with helper files - by El Forum - 12-06-2009, 02:37 AM
Using multiple databases with helper files - by El Forum - 12-06-2009, 02:49 AM
Using multiple databases with helper files - by El Forum - 12-06-2009, 02:57 AM
Using multiple databases with helper files - by El Forum - 12-06-2009, 03:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB