Calling $this->load->database() multiple times - 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: Calling $this->load->database() multiple times (/showthread.php?tid=31130) Pages:
1
2
|
Calling $this->load->database() multiple times - El Forum - 01-12-2011 [eluser]mrbinky3000[/eluser] This is the best solution to the problem. There is a bug in CI. 1 line of code fixes it so you can do stuff like... $a = $this->load->database('default', TRUE); $b = $this->load->database('default', TRUE); ...without the second call to load->database overwriting the first. Here is the bugfix: http://koorb.wordpress.com/2007/11/16/codeigniter-connect-to-multiple-databases/#comment-40 Or if you don't want to go there... #####start bugfix##### Description all of the database calls go to the same database (last one initialized) To fix the probleme change the simple_query function in DB_driver.php: function simple_query($sql) { if ( ! $this->conn_id) { $this->initialize(); } $this->db_select(); //Added this line return $this->_execute($sql); } #####end bugfix##### Calling $this->load->database() multiple times - El Forum - 01-12-2011 [eluser]WanWizard[/eluser] <deleted> note to self: read the rest of the thread before replying... |