Welcome Guest, Not a member yet? Register   Sign In
multiple db connection issue
#1

[eluser]theprodigy[/eluser]
OK, this may be more than one subject, but here goes.....

I am building a module using Matchbox. I need to connect to multiple databases simultaneously. In my model constructor I have
Code:
function MGalleries()
{
    parent::Model();
    $db = $this->load->database('default', TRUE);
    $check = $this->load->database('mine', TRUE);
}

Then, later, I try to use one of them using
Code:
$db->select('...');

but I am receiving an error

Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined variable: db

Filename: models/mgalleries.php

Line Number: 12

What am I doing wrong? Is this something wrong with my Matchbox, or am I supposed to call the database loading from a controller and not in the model constructor?

Please help,

Thanks


Messages In This Thread
multiple db connection issue - by El Forum - 06-08-2009, 09:21 PM
multiple db connection issue - by El Forum - 06-09-2009, 01:50 AM
multiple db connection issue - by El Forum - 06-09-2009, 06:06 AM
multiple db connection issue - by El Forum - 06-09-2009, 06:11 AM
multiple db connection issue - by El Forum - 06-09-2009, 06:13 AM
multiple db connection issue - by El Forum - 06-09-2009, 07:05 AM
multiple db connection issue - by El Forum - 07-26-2009, 12:36 PM



Theme © iAndrew 2016 - Forum software by © MyBB