Switching databases connection for use with $this->load->dbutil(); - 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: Switching databases connection for use with $this->load->dbutil(); (/showthread.php?tid=44335) |
Switching databases connection for use with $this->load->dbutil(); - El Forum - 08-11-2011 [eluser]RECOHA[/eluser] Hello Guys, Sorry about the english, but I've a doubt about one thing. Code: public function fazBackup() This code returns: Code: A PHP Error was encountered I can't do this or I'm doing wrong? Ty. Switching databases connection for use with $this->load->dbutil(); - El Forum - 08-11-2011 [eluser]Christopher Blankenship[/eluser] I am not exactly sure what you are attempting to do but maybe these links may help with your problem. Codeigniter with Multiple Database Support Codeigniter User Guide Codeigniter Forum::connect to multiple databases Switching databases connection for use with $this->load->dbutil(); - El Forum - 08-12-2011 [eluser]RECOHA[/eluser] I'm trying to backup an external databases with dbutil() class. I guess dbutil() class just can use with the databases setup in databases.php. Switching databases connection for use with $this->load->dbutil(); - El Forum - 08-12-2011 [eluser]Christopher Blankenship[/eluser] You can use dbutil() to backup databases and multiple databases at that you just need to setup the databases like shown in the links I provided above then call the one you are wanting to backup. Switching databases connection for use with $this->load->dbutil(); - El Forum - 08-12-2011 [eluser]RECOHA[/eluser] But, I want to backup a lot of MySQL databases. Look, I have an database in my server containing the informations of another databases and I want to connect one to one at a time to backup them with dbutil() class. Is that possible? Switching databases connection for use with $this->load->dbutil(); - El Forum - 08-12-2011 [eluser]danmontgomery[/eluser] You can't load from a database object, you load from the CI object. The dbutil class uses whatever is assigned to $this->db. Code: public function fazBackup() If you're doing this across multiple databases, you still want to explicitly assign the object, because even though CI assigned the db to $this->db, if one is already loaded it won't load it again unless you tell it to. You probably want to also include a call to $this->db->close() between switching databases. Switching databases connection for use with $this->load->dbutil(); - El Forum - 08-12-2011 [eluser]RECOHA[/eluser] Thanks Lab Technician, but the code that you posted above don't work here. Code: A Database Error Occurred Sincerely. |