How to connect with user specified database in codeigniter

前端 未结 3 1108
慢半拍i
慢半拍i 2020-12-06 21:54

I have a project in which i have to connect with user specified database. I want to implement it in a proper codeigniter\'s style but i dont know how can i do that codeignit

3条回答
  •  星月不相逢
    2020-12-06 22:42

    I know that this is an old topic, but I was looking for this information and believe that other people could need too.

    You don’t need to create separate database configurations if you only need to use a different database on the same connection. You can switch to a different database when you need to, like this:

    $this->db->db_select($database2_name)
    

    That solved to me.

提交回复
热议问题