我一直在使用这些代码行在 codeigniter 中连接多个数据库,但出现错误。我的新数据库连接用于 new_group。
$this->new_group = $this->CI->load->database('new_group', TRUE);
$q = $this->new_group->query("SELECT* FROM mytable ORDER BY id DESC");
在非对象上调用成员函数 database()。
等待答复。谢谢
我一直在使用这些代码行在 codeigniter 中连接多个数据库,但出现错误。我的新数据库连接用于 new_group。
$this->new_group = $this->CI->load->database('new_group', TRUE);
$q = $this->new_group->query("SELECT* FROM mytable ORDER BY id DESC");
在非对象上调用成员函数 database()。
等待答复。谢谢
从加载命令中删除 ->CI
$this->new_group = $this->load->database('new_group', TRUE);
$q = $this->new_group->query("SELECT* FROM mytable ORDER BY id DESC");
或者您必须先加载 CI 对象:
$this->CI =& get_instance();
$this->new_group = $this->CI->load->database('new_group', TRUE);
$q = $this->new_group->query("SELECT* FROM mytable ORDER BY id DESC");