ID:               34369
 Updated by:       [EMAIL PROTECTED]
 Reported By:      qlogix at gmail dot com
-Status:           Open
+Status:           Assigned
-Bug Type:         MSSQL related
+Bug Type:         Feature/Change Request
-Operating System: Windows Server 2003 STD
+Operating System: *
-PHP Version:      4.4.0
+PHP Version:      6CVS, 5CVS, 4CVS (2005-09-05)
-Assigned To:      
+Assigned To:      fmk
 New Comment:

This is not a bug, just missing feature. See mysql_connect() prototype:


"resource mysql_connect ([string server [, string username [, string
password [, bool new_link [, int client_flags]]]]])"

mssql_query() misses the 'new_link' parameter.



Previous Comments:
------------------------------------------------------------------------

[2005-09-04 23:43:49] qlogix at gmail dot com

Description:
------------
mssql_query() does not use the link identifier your specify. If you
open two database connections using mssql_connect then specify which
one of those connections to use in mssql_query(), the mssql_query()
function will just use the last connection opened, no matter what.

CONN1 is the address to my local mssql server.

Table donations exists in database db1, not in db2
Table tbl_admin_user exists in database db2, not in db1

If I switch the order of connections, the first query works and the
second one fails, and of course vice versa.

In my case, yes, I am opening two connections to the same server, just
changing the name of the database I want to use, however this
application can be configured to connect to to different servers.

Reproduce code:
---------------
$conn1 = mssql_connect("CONN1","dbuser","dbpass");
mssql_select_db("db1",$conn1);

$conn2 = mssql_connect("CONN1","dbuser","dbpass");
mssql_select_db("db2",$conn2);

$sq = mssql_query("SELECT  * FROM donations",$conn1);

$sq2 = mssql_query("SELECT * FROM tbl_admin_user",$conn2);

Expected result:
----------------
No errors.

Actual result:
--------------
Warning: mssql_query(): message: Invalid object name 'donations'.
(severity 16) in C:\htdocs\noname2.php on line 8

Warning: mssql_query(): Query failed in C:\htdocs\noname2.php on line 8


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=34369&edit=1

Reply via email to