Welcome Guest, Not a member yet? Register   Sign In
Managing two db connections; variable database parameters
#1

[eluser]Unknown[/eluser]
Hello, i'm starting to code in CI and i have some problems with the following matter: I need a controller that will return a list of databases from a given server-login-pass and the tables in each database.

Reading the user guide i've found everything i need, but still i have trouble managing to make this work. I believe i cant rely on the database.php config (multiple groups) since my controler has to accept any given server-login-pass.

Going straight to the point, i've tried this basic code and many variants without luck ;

Code:
$db1 = $this->load->database('mysql://flux:foo@localhost');
$db2 = $this->load->database('mysql://flux:foo@localhost/mydb');

$this->load->dbutil();

$db_list = $db1->list_databases();
print_r($db_list);

$db_tables = $db2->db->list_tables();
print_r($db_tables);


Thanks in advance.




Theme © iAndrew 2016 - Forum software by © MyBB