Re: More include issues
| From: | Richard Lynch | Date: | Wed, 06 Jun 2007 20:57:08 +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-256244@lists.php.net to get a copy of this message | ||
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@gmail.com> 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?