Multiple Database Connection (run time)

[eluser]Amit Patel[/eluser]
Hello All,

I want to connect database at runtime . It is working when i define database info in database.php and connect it using $this->load->database('group_name',TRUE) where group name is define in config/database.php . But when i create connection at runtime using (as help is givne in datbase class but it's not working)
$config['hostname'] = "localhost";
$config['username'] = "myusername";
$config['password'] = "mypassword";
$config['database'] = "mydatabase";
$config['dbdriver'] = "mysql";
$config['dbprefix'] = "";
$config['pconnect'] = FALSE;
$config['db_debug'] = TRUE;
$config['cache_on'] = FALSE;
$config['cachedir'] = "";
$config['char_set'] = "utf8";
$config['dbcollat'] = "utf8_general_ci";


the database is not connected and use old database so how can i connect the database at run time because i have stored the mysql info in the database table so i have to connect database runtime i can't define in database.php....

so how can i do this..

when i print $dbObj i got You have not selected a database type to connect to.

so how can i get connection object at runtime...

Please help me.

Messages In This Thread
Multiple Database Connection (run time) - by El Forum - 03-25-2009, 05:37 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.