Taking wrong database configuration array
Posted
by user309076
on Stack Overflow
See other posts from Stack Overflow
or by user309076
Published on 2010-04-05T07:47:50Z
Indexed on
2010/04/05
7:53 UTC
Read the original article
Hit count: 190
php
|codeigniter
Hi,
I have one application in which i have used 2 database connections. In my database config file i have given two arrays as below.
$active_group = ‘default’; $active_record = TRUE;
FIRST ARRAY $db[‘default’][‘hostname’] = ‘hostname’; .............. ..........
SECOND ARRAY $db[‘another_db’][‘hostname’] = ‘hostname’; .............. ..........
this is working fine.
Now, I copied the entire CI folder to develop another application in which only one database connection needed.
So, now, in the database config file, i deleted the second configuration array. But, the db class is taking first application’s second array i.e. “another_db” and it is giving the below error.
“You have specified an invalid database connection group.”
When i change the default (only one) array name to “another_db” in configuration file. It is working fine. Can’t understand from where it is taking the group name as “another_db”.
My application autoloads database library. I have debugged the ci_auto_loader in Loader.php class where it calls $this->database() function with no parameters. But in function database($params, $, $) {}, if I echo $params it shows “another_db”.
© Stack Overflow or respective owner