[eluser]Stell[/eluser]
Hi all.
Htlp me plz.
My code use 2 DB.
Code:
$active_group = "default";
$active_record = TRUE;
$db['default']['hostname'] = "localhost";
$db['default']['username'] = "user";
$db['default']['password'] = "pass";
$db['default']['database'] = "db1";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";
$active_group = "CM";
$active_record = TRUE;
$db['CM']['hostname'] = "localhost";
$db['CM']['username'] = "user";
$db['CM']['password'] = "pass";
$db['CM']['database'] = "db2";
$db['CM']['dbdriver'] = "mysql";
$db['CM']['dbprefix'] = "";
$db['CM']['pconnect'] = TRUE;
$db['CM']['db_debug'] = TRUE;
$db['CM']['cache_on'] = FALSE;
$db['CM']['cachedir'] = "";
$db['CM']['char_set'] = "utf8";
$db['CM']['dbcollat'] = "utf8_general_ci";
in construc of my class in model:
Code:
$this->db1= $this->load->database('db1', true);
$this->db2= $this->load->database('db2', true);
Next in this model I use 2 query:
Code:
$q1 = $this->db1->get('table1');
$q2 = $this->db2->get('table2');
and get error:
Code:
A Database Error Occurred
Error Number: 1146
Table 'db2.table2' doesnt exist
SELECT * FROM (`table2`)
but q1 execute. Why q2 faling whith this error?
If swap connection in construct $this->db1 и $this->db2, q2 will exec, and q1 will faling whith error.
What wrong?
Thnx.