Multiple database connection in codeigniter

Multiple database connection in codeigniter

CodeIgniter is MVC based PHP framework, it is possible Multiple database connection in codeigniter. so you can follow below code.

Open the Database.php file

if you want to connect multiple databases in CodeIgniter then open the database.php file. this configuration file available in the array format so you have to do it second database in an array configuration.

there is two connection of the following example for CodeIgniter. first is by default CodeIgniter provide and we will create a second connection. change the database name, database username, and database password in the second connection.

see below example

The databases configuration after you can access the database.

Please follow and like us: