Request to the 2 DB at the same time - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Request to the 2 DB at the same time (/showthread.php?tid=32169) |
Request to the 2 DB at the same time - El Forum - 07-14-2010 [eluser]Stell[/eluser] Hi all. Htlp me plz. My code use 2 DB. Code: $active_group = "default"; in construc of my class in model: Code: $this->db1= $this->load->database('db1', true); Next in this model I use 2 query: Code: $q1 = $this->db1->get('table1'); and get error: Code: A Database Error Occurred 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. Request to the 2 DB at the same time - El Forum - 07-15-2010 [eluser]WanWizard[/eluser] Shouldn't that be Code: $this->db1= $this->load->database('default', true); And you can only have one active group in your config, your second assignment overwrites the first. Request to the 2 DB at the same time - El Forum - 07-15-2010 [eluser]Stell[/eluser] Sorry? of course Code: $active_group = "CM"; Request to the 2 DB at the same time - El Forum - 07-15-2010 [eluser]Stell[/eluser] Fixed. Thx for all. Resolution: Code: $db['CM']['pconnect'] = TRUE; |