Welcome Guest, Not a member yet? Register   Sign In
Access database config file
#1

[eluser]Unknown[/eluser]
I am trying to access the database config file from a model. I've tried things like:
Code:
$this->config->item('hostname');
$this->config->load('database', TRUE));
$db_hostname = $this->config->item('hostname', 'database');

But no matter how hard I try I can't access the parameters.

Here is why I want to access these parameters: I got 'root' login on my MySQL system, there are about 150 databases on this system which I want to manage by 1 project in code igniter. So basicly I only want to switch to another database with the same connection parameters (username, password, host).

Ideally, something like this would be great:
Code:
$this->db->selectdb('other dbname');


Options like 150 groups in the database config file isn't really a option. So the only thing left is to access the above mentioned parameters and do a manual connection.

Any smart suggestions?




Theme © iAndrew 2016 - Forum software by © MyBB