Welcome Guest, Not a member yet? Register   Sign In
one codeigniter application folder run two databases
#2

@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);
Reply


Messages In This Thread
RE: one codeigniter application folder run two databases - by php_rocs - 05-10-2019, 06:51 AM



Theme © iAndrew 2016 - Forum software by © MyBB