Query multiple databases |
[eluser]Eildydar[/eluser]
I am trying to query multiple databases within the same page and I am having trouble getting it to work. in my model I have the following. Code: foreach($query->result() as $row) { Code: $mysql = $this->load->database('default'); But I keep getting an error stating "You have not selected a database type". This is a code igniter error and doesn't show up in any logs anywhere for php or apache. Is this something that should be possible?
[eluser]meigwilym[/eluser]
The guide says you need to pass TRUE as a 2nd argument to the load->database() method. Mei
[eluser]meigwilym[/eluser]
And did you set the $db['default']['dbdriver'] and $db['osbc']['dbdriver'] correctly?
[eluser]Eildydar[/eluser]
yes they are set exactly the same one just points to a different server (this is not my end goal but set up that way for testing since that was best way to ensure no issues with config). Copy and paste just changing the host.
[eluser]Eildydar[/eluser]
Any other ideas? Is this something that CodeIgniter will even support?
[eluser]Eildydar[/eluser]
So I didn't think to do this before but I tried to just use the odbc link and it doesn't work at all. I have included the entire database.php file below. Not sure if I need to change anything in any other files. Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
[eluser]CroNiX[/eluser]
Connecting to Multiple Databases Code: $mysql = $this->load->database('default', TRUE);
|
Welcome Guest, Not a member yet? Register Sign In |