Re: More include issues

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

 



Use two different $connection variables, say, $mssql and $informix and
pass them in as the optional arg to _query or whatever, and then you
can avoid flip-flopping like that.

On Wed, June 6, 2007 3:53 pm, 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.
>
>
> 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
>>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
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