[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)
Code:
$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";
$this->load->database($config);
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.