Re: More include issues

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

 



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.


On 6/6/07, Stut <stuttle@xxxxxxxxx> wrote:

Dan Shirah wrote:
> I thought that if you made a connection at the beginning of a page, that
> you could use that connection throughout the page without having to type
> it over again as long as you did not explicitly put in code to close the
> connection??  Which is why I only inserted the include fil at the
> beginning of the page.
>
> Instead of having:
>
> $connection = mssql_pconnect('SERVER','user','password') or die ('server
> connection failed');
> $database = mssql_select_db("database", $connection) or die ('DB
> selection failed');
>
> in my include file, I should only have $connection instead and then
> specify $database before the query to the database.
>
> Does that sound like the correct solution?

The way you have it at the moment should work fine. Might I suggest you
try using a non-persistant connection? I've heard things in the past
that the persistant connection implementation in the MSSQL extension can
be a bit flakey.

-Stut


[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