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

(05-10-2019, 06:51 AM)php_rocs Wrote: @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);

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.
Reply


Messages In This Thread
RE: one codeigniter application folder run two databases - by morsi - 05-10-2019, 07:28 AM



Theme © iAndrew 2016 - Forum software by © MyBB