1

I have 2 database called database1, database2 in my cakephp application. before login I have drop down of database(database1,database2).

If user selects database1 then databse1 should be default database for application

and if user selects database2 from drop down then database2 should be default database for application

below is my default database code

public $default = array(
    'datasource' => 'Database/Mysql',
    'persistent' => false,
    'host' => 'localhost',
    'login' => 'root',
    'password' => '',
    'database' => 'database1',
    'prefix' => 'tbl_',
    //'encoding' => 'utf8',
);

Thanks in advance

Tejas Khutale
  • 84
  • 2
  • 19
  • http://stackoverflow.com/questions/13223946/how-to-use-multiple-databases-dynamically-for-one-model-in-cakephp plz check this url . hope this will help – Akshay Sharma Mar 21 '16 at 12:51
  • I have checked that link.But in that link they have set database in function.but in my application I have all controller same for the both database. – Tejas Khutale Mar 21 '16 at 12:56

0 Answers0