Multiple Database Connection in PHP CodeIgniter | Switch dynamic database from other DB

Опубликовано: 06 Октябрь 2024
на канале: Knowledge Thrusters
4,338
30

Multiple Database Connection in PHP CodeIgniter | Switch dynamic database from other DB. In this video tutorial, you will be able to connect multiple databases in CodeIgniter.

Steps:
Load your default database in database.php
Then create a database in which you will be storing all the database credentials
Fetch Credentials according to url segment
In url, i am taking id of a particular database connnection
There are different ways you will be getting your database credentials
Get your database credentials

Then, create a database config array in which pass your database credentials like hostname, username, password and database name

Then load the database and make a connection with that database.


Link:
Connecting to your Database
https://codeigniter.com/userguide3/da...

Database Configuration
https://codeigniter.com/userguide3/da...