dtnpf35197 2010-04-05 07:47
浏览 23

采用错误的数据库配置数组

I have one application in which i have used 2 database connections. In my database config file i have given two arrays as below.

$active_group = ‘default’; $active_record = TRUE;

FIRST ARRAY $db[‘default’][‘hostname’] = ‘hostname’; .............. ..........

SECOND ARRAY $db[‘another_db’][‘hostname’] = ‘hostname’; .............. ..........

this is working fine.

Now, I copied the entire CI folder to develop another application in which only one database connection needed.

So, now, in the database config file, i deleted the second configuration array. But, the db class is taking first application’s second array i.e. “another_db” and it is giving the below error.

“You have specified an invalid database connection group.”

When i change the default (only one) array name to “another_db” in configuration file. It is working fine. Can’t understand from where it is taking the group name as “another_db”.

My application autoloads database library. I have debugged the ci_auto_loader in Loader.php class where it calls $this->database() function with no parameters. But in function database($params, $, $) {}, if I echo $params it shows “another_db”.

  • 写回答

2条回答 默认 最新

  • dtftao7249656 2010-04-05 09:52
    关注

    To select the first database just do: $this->load->database();

    and queries: $this->db->get('table');

    to Select the second_db: $DB2=$this->load->database(‘another_db’);

    $DB2->get('Table');

    Regards,
    Pedro

    评论

报告相同问题?

悬赏问题

  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端