To use multiple databases in CodeIgniter, what method is typically employed in the controller?

  • Defining multiple $db arrays in the config file
  • Initializing a new instance of the database class
  • Loading a different configuration file
  • Using the model's load method with database parameters
To use multiple databases in CodeIgniter, a common method is to load a different database configuration in the controller by using $this->load->database('second_db', TRUE). This initializes a new database connection.
Add your answer
Loading...

Leave a comment

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