Reputation: 1231
I have been using these lines of code for connecting multiple databases in codeigniter but getting error. My new db connection is for new_group.
$this->new_group = $this->CI->load->database('new_group', TRUE);
$q = $this->new_group->query("SELECT* FROM mytable ORDER BY id DESC");
Call to a member function database() on a non-object.
Waiting for response. Thanks
Upvotes: 0
Views: 401
Reputation: 60068
remove ->CI from the load command
$this->new_group = $this->load->database('new_group', TRUE);
$q = $this->new_group->query("SELECT* FROM mytable ORDER BY id DESC");
or you have to load the CI object first:
$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");
Upvotes: 2
Reputation: 616
Try this http://codeigniter.com/forums/viewthread/145901/
$db['new_group']['pconnect'] = FALSE;
I didnt try...
Upvotes: 2