09-09-2008, 02:59 PM
[eluser]sublight[/eluser]
Okay, I've tried this two ways, the first way:
//load DB1
$this->load->database('secret');
$query = $this->db->query('SELECT * FROM user WHERE id = '.$id);
//insert DB2
$this->load->database('notsecret');
$sql = "INSERT INTO comments blah blah blah";
$this->db->query($sql);
will always try to insert the "comments" db into secret instead of notsecret...
But if I do as the manual says when setting up two dbs:
//load two databases
$secretDB = $this->load->database('secret', TRUE);
$notsecretDB = $this->load->database('notsecret', TRUE);
$query = $secretDB->query('SELECT * FROM user WHERE id = '.$id);
$sql = "INSERT INTO comments blah blah blah";
$notsecretDB->query($sql);
It tries to query the user from notsecret instead of secret. Notsecret is the default in the database config.
Is there a way to unload the db in between or am I missing a command?
Thanks for your time! I appreciate your help.
Okay, I've tried this two ways, the first way:
//load DB1
$this->load->database('secret');
$query = $this->db->query('SELECT * FROM user WHERE id = '.$id);
//insert DB2
$this->load->database('notsecret');
$sql = "INSERT INTO comments blah blah blah";
$this->db->query($sql);
will always try to insert the "comments" db into secret instead of notsecret...
But if I do as the manual says when setting up two dbs:
//load two databases
$secretDB = $this->load->database('secret', TRUE);
$notsecretDB = $this->load->database('notsecret', TRUE);
$query = $secretDB->query('SELECT * FROM user WHERE id = '.$id);
$sql = "INSERT INTO comments blah blah blah";
$notsecretDB->query($sql);
It tries to query the user from notsecret instead of secret. Notsecret is the default in the database config.
Is there a way to unload the db in between or am I missing a command?
Thanks for your time! I appreciate your help.