Welcome Guest, Not a member yet? Register   Sign In
CI multiple connections
#1

[eluser]Sub-Zero[/eluser]
Hi!

I'm running three models (ModelA, ModelB and ModelC) in the same controller.
ModelA and ModelB are accessing the same database connection, however,
ModelC is accessing a different database connection. The problem that
I'm having is that when I run the controller ModelA and ModelB run fine,
but it doesn't run ModelC that is accessing a different db connection. If
I put ModelC before ModelA and ModelB then the controller run ModelC, but
it doesn't run ModelA and Model B. BTW, I already setup the config file
(database) to manage multiple connections. Any comments?

Here is what I'm trying to do:

class Sample_controller extends Controller
{
function _construct()
{
parents::Controller();
$this->load->library('session');
$this->load->model('Db_ModelA_model', 'db_modelA');
$this->load->model('Db_ModelB_model', 'db_modelB');
$this->load->model('Db_ModelC_model', 'db_modelC');
.
.
.
In the sample above, Db_ModelA_model and Db_ModelB_model
run okay and they are using the same db connection, but it
doesn't like Db_ModelC_model because is using a different
db connection.
#2

[eluser]Aniket[/eluser]
hi,

Did you load the db using your another connection in Db_ModelC_model ? Then i think this issue should not arise.




Theme © iAndrew 2016 - Forum software by © MyBB