I have two databases and want to select one database at the time of login. I have userid: user1 in both databases and I have userid, password and database dropdown option to select database in login form, how I can achive this, by this way or some other way?
In database.php
class DATABASE_CONFIG {
public $default = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'root',
'password' => '',
'database' => 'abc',
'prefix' => '',
//'encoding' => 'utf8',
);
public $second = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'root',
'password' => '',
'database' => 'xyz',
'prefix' => '',
//'encoding' => 'utf8',
);
You can override the Model constructor setting the datasource as you need. Like this
Ask me if you need more information