php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36639 mssql_select_db(); didnt work for multiple connection
Submitted: 2006-03-07 05:10 UTC Modified: 2006-03-10 09:07 UTC
From: Satria at dreamweb dot co dot id Assigned:
Status: Not a bug Package: MSSQL related
PHP Version: 5.1.2 OS: NT2K
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: Satria at dreamweb dot co dot id
New email:
PHP Version: OS:

 

 [2006-03-07 05:10 UTC] Satria at dreamweb dot co dot id
Description:
------------
mssql_select_db() also override Used Database on the another Connection

Reproduce code:
---------------
$sqlLink1=mssql_connect($host,$user,$pass);
$SecondLINK=mssql_connect($host,$user,$pass);
/*Yes, both connection on same Machine*/

mssql_select_db('db1',$sqlLink1); 

/*Until here, still no problem*/ 
mssql_select_db('db2', $SecondLINK); 


//Second time DB Select also will override $sqlLink1, is this Bugs? or... its what should it be ?

Expected result:
----------------
mssql_select_db() only affected on the $param2 connection

Actual result:
--------------
-

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-07 06:59 UTC] Satria at dreamweb dot co dot id
Description:
------------
mssql_select_db() also override Used Database on the another Connection

Reproduce code:
---------------
$sqlLink1=mssql_connect($host,$user,$pass);
$SecondLINK=mssql_connect($host,$user,$pass);
/*Yes, both connection on same Machine*/

mssql_select_db('db1',$sqlLink1); 

/*Until here, still no problem*/ 
mssql_select_db('db2', $SecondLINK); 

//Second time DB Select also will override $sqlLink1, is this Bugs?
or... its what should it be ?

Expected result:
----------------
mssql_select_db() only affected on the $param2 connection

Actual result:
--------------
-
 [2006-03-07 14:23 UTC] Satria at dreamweb dot co dot id
there is another solutions for this 
(if this were MySQL Function)

force mysql_connect to open newLink

but http://php.net/mssql_connect
didnt have that parameter on the connect Option
 [2006-03-08 21:06 UTC] fmk@php.net
The MSSQL Extension shares the internal connection as long as host, user and password are the same. To avoid this you can use an optional 4th parameter (new_link = true|false). Setting this to true will force the system to create a new link internaly.
 [2006-03-09 02:03 UTC] Satria at dreamweb dot co dot id
Description
resource mssql_connect ( [string servername [, string username [, string password]]] )

There is no 4th Parameter
 [2006-03-09 19:22 UTC] fmk@php.net
This is a bug in the documentation and I'll update it. The forth parameter does exist and it does work. From the code:

proto int mssql_connect([string servername [, string username [, string password [, bool new_link]]])

 [2006-03-10 09:07 UTC] Satria at dreamweb dot co dot id
ah... okay,
Thats will help me alots...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Oct 08 20:01:27 2024 UTC