Codeigniter - Using Multiple Databases

后端 未结 6 726
甜味超标
甜味超标 2020-11-29 04:01

database.php:

$db[\'default\'][\'hostname\'] = \"192.168.2.104\";
$db[\'default\'][\'username\'] = \"webuser\";
$db[\'default\'][\'password\         


        
6条回答
  •  不知归路
    2020-11-29 04:45

    I fix the problem changing the DB_driver.php on the framework.

    In this function I add $this->db_select(); and you never lose your connection again when working with 2 databases.

    function simple_query($sql)
    {
        if ( ! $this->conn_id)
        {
            $this->initialize();
        }
    
        $this->db_select();
    
        return $this->_execute($sql);
    }
    

提交回复
热议问题