Welcome Guest, Not a member yet? Register   Sign In
Switch database based on parameter
#6

a example quick code:

1) go to application/config.php and made a common config:
$config['sysdb'] =  array(
'hostname'=>'localhost','username'=>'dbuser','password'=>'dbuserclave',
'database'=>'', /* this will be changed "on the fly" in controler */
'dbdriver'=>'mysqli','dbprefix'=>'',
'pconnect'=>FALSE,'db_debug'=>TRUE,'cache_on'=>FALSE
);

2) now in u'r controller made "each time u want to change" a database name with same connections parameters:
 $configdbfly = $this->config->config['sysdb'];
 $configdbfly['database']='sysdbadminis'; /*cambiamos de db*/
 $this->load->database($configdbfly);


THE MORE DETAILED AND HOW TO HERE:
http://qgqlochekone.blogspot.com/2017/02...n-fly.html
Reply


Messages In This Thread
Switch database based on parameter - by rejoan - 04-21-2015, 12:40 AM
RE: Switch database based on parameter - by mckaygerhard - 02-11-2017, 10:40 AM



Theme © iAndrew 2016 - Forum software by © MyBB