Re: More include issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux