Trouble changing databases for my models in codeigniter

PompyCiepla81

New Member
I'm making a website with two different databases. Let's say one is DB1, and the other is DB2. I've set up my database.php in the config folder, so they each have the correct host/password/username/database etc with db['DB1']['hostname'] and the other db['DB2']['hostname'] etc, so I'm pretty sure I've got that part right.According to CodeIgniter docs, I'm supposed to do $this->load->database('DB1') to get that one to work within my model. First, I put it in my constructor for my model, and it didn't work. Then I tried putting that line as the first line of every function in the model, and that didn't work. I'm still getting this error:\[code\]Error Number: 1146Table 'DB2.stores' doesn't exist\[/code\]When I'm trying to use DB1, and have done $this->load->database('DB1') as the first line of the model's function. Does anyone know what I'm doing wrong? Thanks!
 
Top