CodeIgniter Forums
Change dbprefix during runtime? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Change dbprefix during runtime? (/showthread.php?tid=32934)



Change dbprefix during runtime? - El Forum - 08-10-2010

[eluser]Akinzekeel[/eluser]
Hi everyone,

first of all I'd like to thank all the developers of CodeIgniter for this great framework. I discovered it about 2 months ago and I love it!

Here's my question: Is it possible to change the prefix of the table names (when using Active Record) later during the runtime, perhaps in a controller function? Or can I completely turn prefixing off for a specific controller function?

Any help would be appreciated.

Regards


Change dbprefix during runtime? - El Forum - 08-10-2010

[eluser]WanWizard[/eluser]
You can modify the prefix using
Code:
$this->db->dbprefix = 'new_';



Change dbprefix during runtime? - El Forum - 08-11-2010

[eluser]Akinzekeel[/eluser]
Just what I needed, thanks!


Change dbprefix during runtime? - El Forum - 02-20-2012

[eluser]Ben Bowler[/eluser]
Can this be done for one library or model? or only when querying a specific table?