one codeigniter application folder run two databases |
Hi,
I know that it's possible to use a different database on the same connection but i want to use differents databases with differents connections with my CI application. I have an application for many customers (so one codeigniter application folder), every customer has his own database and his own domain name but all clients need only one application. So I want to choose the database according to the domain :
@morsi,
Here is how you do multiple connections to multiple databases: https://www.codeigniter.com/user_guide/d...-databases Then all you have to do is when you set your $DB at the top of your model use the ternary option like this $DB = (site_url() == 'domain1')? $this->load->database('db_connection1', TRUE): $this->load->database('db_connection2', TRUE); (05-10-2019, 06:51 AM)php_rocs Wrote: @morsi, Thanks for help but i think i must also change $config['base_url'] into config.php ? How i can do it ? (Remmembre, i want to use one CI folder and files with many domains and databases) Thanks.
Setting your base url in Codeigniter
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |