Welcome Guest, Not a member yet? Register   Sign In
Change database in controller
#1

[eluser]huzzel[/eluser]
Hi,

i tried to add a dynamic database via dsn or $db but it wont connect :-(

Code:
function view($id){
        // get mysql details
        $data['site'] = $this->databaseModel->get_by_id($id)->row();

        $db['current']['hostname'] = $data['site']->mysql_ip;
        $db['current']['username'] = $data['site']->mysql_user;
        $db['current']['password'] = $data['site']->mysql_pw;
        $db['current']['database'] = $data['site']->mysql_db;

        $dsn = 'dbdriver://username:password@XXXX/database?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir;=/path/to/cache';

        $db_current = $this->load->database($dsn);

        print_r($db_current);

        // load view
        $this->load->view('typolightView', $data);
    }


Messages In This Thread
Change database in controller - by El Forum - 08-27-2009, 12:56 AM
Change database in controller - by El Forum - 08-27-2009, 01:09 AM
Change database in controller - by El Forum - 08-27-2009, 01:30 AM
Change database in controller - by El Forum - 08-27-2009, 01:34 AM
Change database in controller - by El Forum - 08-27-2009, 01:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB