[eluser]E-Finity Internet[/eluser]
Hello,
Is it possible to globals in a database table using the database config table for a 2nd set?
I use the following config:
(config / database.php)
$ db [ 'default'] [ 'hostname'] = "localhost";
$ db [ 'default'] [ 'username'] = "admin";
$ db [ 'default'] [ 'password'] = "password";
$ db [ 'default'] [ 'database'] = "config_database";
$ db [ 'default'] [ 'dbdriver'] = "mysql";
$ db [ 'default'] [ 'dbprefix'] = "";
$ db [ 'default'] [ 'pconnect'] = TRUE;
$ db [ 'default'] [ 'db_debug'] = TRUE;
$ db [ 'default'] [ 'cache_on'] = FALSE;
$ db [ 'default'] [ 'cachedir'] = "";
$ db [ 'default'] [ 'char_set'] = "utf8";
$ db [ 'default'] [ 'dbcollat'] = "utf8_general_ci";
$ Db [ 'external'] [ 'hostname'] = "localhost";
$ Db [ 'external'] [ 'username'] = "user";
$ Db [ 'external'] [ 'password'] = "password";
$ Db [ 'external'] [ 'database'] = "website_database";
$ Db [ 'external'] [ 'dbdriver'] = "mysql";
$ Db [ 'external'] [ 'dbprefix'] = "";
$ Db [ 'external'] [ 'pconnect'] = TRUE;
$ Db [ 'external'] [ 'db_debug'] = TRUE;
$ Db [ 'external'] [ 'cache_on'] = FALSE;
$ Db [ 'external'] [ 'cachedir'] = "";
$ Db [ 'external'] [ 'char_set'] = "utf8";
$ Db [ 'external'] [ 'dbcollat'] = "utf8_general_ci";
The first table I get my configuration. There are also details of the website which I want to connect to database. Which must therefore be in the [ 'external'] are used. I believe as follows:
$ db [ 'external'] [ 'hostname'] = $ user settings-> hostname;
$ db [ 'external'] [ 'username'] = $ user settings-> username;
$ db [ 'external'] [ 'password'] = $ user settings-> password;
$ db [ 'external'] [ 'database'] = $ user settings-> database;
$ db [ 'external'] [ 'dbdriver'] = "mysql";
$ db [ 'external'] [ 'dbprefix'] = "";
$ db [ 'external'] [ 'pconnect'] = TRUE;
$ db [ 'external'] [ 'db_debug'] = TRUE;
$ db [ 'external'] [ 'cache_on'] = FALSE;
$ db [ 'external'] [ 'cachedir'] = "";
$ db [ 'external'] [ 'char_set'] = "utf8";
$ db [ 'external'] [ 'dbcollat'] = "utf8_general_ci";