Welcome Guest, Not a member yet? Register   Sign In
load->database not working
#1

Hi,
I have 2 database configs in config/database.php, default and opentimes
$active_group = 'default'

I load opentimes with $db1 = $this->load->database('opentimes');
A simple query $db1->query(sql stuff) fails with 'none object' errors

If in the config I make the $active_group = 'opentimes' then the same query works....


Ed..
Reply
#2

Have you tried setting the second parameter to TRUE?
PHP Code:
$db1 $this->load->database('opentimes'TRUE); 

This allows you to connect to multiple databases simultaneously. Without the second parameter, $this->load->database() is likely returning FALSE because you're already connected to a database (probably via autoload).
Reply
#3

Yes, setting TRUE worked...
Reply




Theme © iAndrew 2016 - Forum software by © MyBB