dbutil - how to target a different group? - 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: dbutil - how to target a different group? (/showthread.php?tid=26177) |
dbutil - how to target a different group? - El Forum - 01-07-2010 [eluser]da_n[/eluser] Hello. I've searched the forums and found a few topics related to my question, but no definitive answer so really hope someone can help or let me know a definite yes/no answer. I want to know if there is any way to define a different database group other than the default when using dbutil. I have a project which I want to run automated backups for several databases, but I get errors. Here is my (early) code which I have put [removed] to hide passwords etc: database.php Code: $active_group = "default"; controller Code: class Backup extends Controller { It would be a pain to have to set-up a whole new codeigniter project for every database, let alone hard to manage. Any help would be greatly appreciated. Thanks. dbutil - how to target a different group? - El Forum - 01-07-2010 [eluser]da_n[/eluser] Realised I should probably have mentioned the errors. There are loads that come, here are the first 4: Code: A PHP Error was encountered dbutil - how to target a different group? - El Forum - 01-07-2010 [eluser]danmontgomery[/eluser] Instead of: Code: $this->dbutil->backup($prefs); Try Code: $db2->dbutil->backup($prefs); dbutil - how to target a different group? - El Forum - 01-07-2010 [eluser]da_n[/eluser] Thanks but I tried this before, I just get the following error: Code: A PHP Error was encountered By the way the code does work if I use the default group only. EDIT: Sorry there was a little problem with the controller code but it does work, it just needs instances of Code: $filename_$date Code: $filename".'_'."$date dbutil - how to target a different group? - El Forum - 01-08-2010 [eluser]danmontgomery[/eluser] The above error is because you're calling load() on a mysql object instead of a controller object. Post line 13 of controllers/backup.php |