Welcome Guest, Not a member yet? Register   Sign In
Dynamically set up multiple array concurrent connections
#8

[eluser]WanWizard[/eluser]
Ok, not too difficult.

This assumes that you have a user db definition in your config database.php called 'users'.
Code:
public function load_userdb($userdb)
{
    // load the database config
    include APPPATH.'config/database.php';

    // make sure we have our DB config
    if ( ! isset($db) || ! is_array($db) || ! array_key_exists('users', $db) )
    {
        // oops, bail out!
        die('WTF?');
    }
    else
    {
        // store the custom db name
        $db['users']['database'] = $userdb;

        // and make the DB connection
        $this->userdb = $this->load->database( $db['users'] );
    }
}


Messages In This Thread
Dynamically set up multiple array concurrent connections - by El Forum - 03-25-2011, 06:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB