switching between 20 database |
[eluser]Unknown[/eluser]
hi, i have 20 websites with the same database structures ,each one has his own back-end and it take lot of time to do some changes becuase i have to loggin to each one to work on. to resolve this problem , i took one of my back-ends i tried to do some changes on it to work for all my websites. first i created a database for this project with a ‘user’ table for the logging process, then in my administration interface i added a dropdown menu to select witch website/database i’d like to work on. the problem is how can i swtich between my 20 databases (this number can change) without changing my models/controllers , because i have too many many files (models/controllers). i’m using CI V1.7.2 thanks.
[eluser]jmadsen[/eluser]
http://ellislab.com/codeigniter/user-gui...cting.html
[eluser]Unknown[/eluser]
i looked there before i post. i have to mention that in config/database.php file i just added the params to connect to the logging database, and the others 20 database params are stored on my session after the logging prosess , so when i select a website to work on it i have to close the default connection and open a new one with selected website params.
[eluser]Aditzu[/eluser]
[quote author="nooneelse" date="1352121390"]i looked there before i post. i have to mention that in config/database.php file i just added the params to connect to the logging database, and the others 20 database params are stored on my session after the logging prosess , so when i select a website to work on it i have to close the default connection and open a new one with selected website params.[/quote] You can simply set your logging database as your default database and for the other databases just set like this: Code: $DB1 = $this->load->database('site1', TRUE); Code: $DB20 = $this->load->database('site20', TRUE); Code: $this->db->query(); and Code: $DB1->query(); for the rest of if |
Welcome Guest, Not a member yet? Register Sign In |