Welcome Guest, Not a member yet? Register   Sign In
Switch Database
#1

Hello everyone

I have searched the forum for a solution to my problem but have not found an answer

I have to change the name of the database depending on who connects to the web page

the only data that changes is the name of the db (DB1, DB2, DB3, DB4 .......)


Code:
$active_group = 'default';
$query_builder = TRUE;

$db['default'] = array(
    'dsn'    => '',
    'hostname' => 'localhost',
    'username' => 'root',
    'password' => 'Test',
    'database' => 'DB1',
    'dbdriver' => 'mysqli',
    'dbprefix' => '',
    'pconnect' => FALSE,
    'db_debug' => (ENVIRONMENT !== 'production'),
    'cache_on' => FALSE,
    'cachedir' => '',
    'char_set' => 'utf8',
    'dbcollat' => 'utf8_general_ci',
    'swap_pre' => '',
    'encrypt' => FALSE,
    'compress' => FALSE,
    'stricton' => FALSE,
    'failover' => array(),
    'save_queries' => TRUE
);

I have to change only this data 'database' => 'DB1', in the array, passing a variable

You can help me?

thank you so much
Reply


Messages In This Thread
Switch Database - by federcla - 04-13-2020, 10:44 AM
RE: Switch Database - by cyberstunts - 04-13-2020, 05:04 PM
RE: Switch Database - by federcla - 04-14-2020, 03:43 AM
RE: Switch Database - by cyberstunts - 04-14-2020, 05:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB