multiple database connection in codeigniter

CodeIgniter is MVC based PHP framework, CodeIgniter in possible to multiple database connections.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *