[eluser]zay yar phone[/eluser]
If I understand you correctly
1) database configuration settings for 100 databases are stored in the main database.
2) Users are authenticated using the main database.
3)Once the users are authenticated you have to figure out the their respective database to connect to.
In the authentication process store the user specific database name into the PHP
$_SESSION['db_name'] = 'db1'; // db1 is the databasename
Write the My_Model which extends the CI_Model. Store MY_Model into the ./applications/core/
In the Constructor of My_Model class establish the database connection dynamically.
Code:
$specific['hostname'] = 'xxx';
$specific['username'] = 'xxx';
$specific['password'] = 'xxxx';
$specific['database'] = $_SESSION['db_name']; // this is the db name
$specific['dbdriver'] = 'mysql';
$specific['dbprefix'] = '';
$specific['pconnect'] = TRUE;
$specific['db_debug'] = TRUE;
$specific['cache_on'] = FALSE;
$specific['cachedir'] = '';
$specific['char_set'] = 'utf8';
$specific['dbcollat'] = 'utf8_general_ci';
$specific['swap_pre'] = '';
$specific['autoinit'] = TRUE;
$specific['stricton'] = FALSE;
$this->load->database($specific);
All finally all your Model class extends the MY_Model.
Code:
// in certain case which you want to connect to the main database in between
$this->load->database(); // without any parameter