Re: More include issues

From: Date: Wed, 06 Jun 2007 20:57:18 +0000
Subject: Re: More include issues
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.general 
Request: Send a blank email to php-general+get-256245@lists.php.net to get a copy of this message
Dan Shirah wrote:
It seems that PHP is getting confused unless I post the $database = mssql_select_db("database", $connection) or die ('DB selection failed'); before the query. This is probably due to the fact that I am pulling information from multiple databases (Two MSSQL and One Informix) So if my query just starts out with $sql = "Select * from..." it doesn't really know which connection to use.
OK, that's more than a little annoying. I wish you'd mentioned that you're using multiple database connection, this would have been so much easier. The mssql_query function can take the connection resource as a second parameter. This also goes for every other database function. If you're using multiple database connections you *need* to be passing that in. In fact, even if you're not currently using multiple connections I would recommend that people always pass the connection resource to the DB functions - it saves a lot of headaches if you ever need to use a second connection. -Stut

« previous php.general (#256245) next »