[eluser]Unknown[/eluser]
What is the best way to achieve this? The thing i'm struggling with is that the database name (lets say 'userdb_197', for user #197), in the database config file can't be variable. There for, every time i need to access that database i manually need to make a database connection.
No problems till now, but when i want to use the dbutil class, i can't manually create a database connection, because it automatically uses the settings set in the database config file.
Is there anyway to make the 'database' element in the database config file variable?
Beneath is my config file. I have 2 databases. One variable depending on the user ('user'), and one a static one ('app'). So is there any way to make the database variable in the 'user' database, depending on the user.
Code:
$db['user']['hostname'] = "localhost";
$db['user']['username'] = "basje";
$db['user']['password'] = "*******";
$db['user']['database'] = "";
$db['user']['dbdriver'] = "mysql";
$db['user']['dbprefix'] = "";
$db['user']['pconnect'] = TRUE;
$db['user']['db_debug'] = TRUE;
$db['user']['cache_on'] = FALSE;
$db['user']['cachedir'] = "";
$db['user']['char_set'] = "utf8";
$db['user']['dbcollat'] = "utf8_general_ci";
$db['app']['hostname'] = "localhost";
$db['app']['username'] = "basje";
$db['app']['password'] = "*******";
$db['app']['database'] = "basis";
$db['app']['dbdriver'] = "mysql";
$db['app']['dbprefix'] = "";
$db['app']['pconnect'] = TRUE;
$db['app']['db_debug'] = TRUE;
$db['app']['cache_on'] = FALSE;
$db['app']['cachedir'] = "";
$db['app']['char_set'] = "utf8";
$db['app']['dbcollat'] = "utf8_general_ci";