Re: More include issues
| From: | Dan Shirah | Date: | Wed, 06 Jun 2007 20:53:28 +0000 |
| Subject: | Re: More include issues | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-256243@lists.php.net to get a copy of this message | ||
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