Change database [SOLVED] |
[eluser]Santiag0[/eluser]
Hi! I have to change the database which is indicated in the database configuration file. I try with: $config['database'] = 'database_name2; $this->app->load->database($config); Some idea to change the value of the config/database.php Thanks!
[eluser]slowgary[/eluser]
In your code above you've left out the second quote. Also, I believe it's Code: $this->load->database(); You can also autoload the database using application/config/autoload.php This is all explained very easily in the user guide.
[eluser]Santiag0[/eluser]
Thanks for reply! Yes, i do a mistake. But I need change dynamically the configuration default db to make all request to that database. Bacause I have 3 diferente databases with diferente data, and in the login panel you can select user, pass and database. It's clear? ![]()
[eluser]Dam1an[/eluser]
See the Database documentation to see how to load multiple databases Is that what you're after?
[eluser]Santiag0[/eluser]
Thank you! I saw the manual but don't try these examples. The final code: Code: //Select the database So, when I do $this->db->get('table') works, and I don't need to change all my codes, thanks a lot! |
Welcome Guest, Not a member yet? Register Sign In |