Welcome Guest, Not a member yet? Register   Sign In
Set multiple connections for mssql dbs?
#3

[eluser]danmontgomery[/eluser]
No...

You have a few problems here, none of them are the inclusion of extra $active_group/$active_record lines.

First, Passing TRUE as the second parameter in $this->load->database() returns the object, rather than assigning it. You're doing this correctly in your first load statement, but not in your second.

Second, What is returned is an object, not an mssql link id. You should never be using mssql_query() in CI. You should be using the DB object you've loaded for yourself.

Code:
$this->suburbDb = $this->load->database('suburb', TRUE);
$this->defaultDb = $this->load->database('default', TRUE);

$res = $this->suburbDb->query('SELECT TOP 100 ID FROM Table');

Connecting to multiple databases is explained (with examples) in the user guide: http://ellislab.com/codeigniter/user-gui...cting.html, as is running queries and generating query results.


Messages In This Thread
Set multiple connections for mssql dbs? - by El Forum - 07-11-2011, 02:36 AM
Set multiple connections for mssql dbs? - by El Forum - 07-11-2011, 09:32 AM
Set multiple connections for mssql dbs? - by El Forum - 07-11-2011, 11:23 AM



Theme © iAndrew 2016 - Forum software by © MyBB