From:             qlogix at gmail dot com
Operating system: Windows Server 2003 STD
PHP version:      4.4.0
PHP Bug Type:     MSSQL related
Bug description:  mssql_query() does not use link identifier

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 bug report at http://bugs.php.net/?id=34369&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=34369&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=34369&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=34369&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=34369&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=34369&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=34369&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=34369&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=34369&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=34369&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=34369&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=34369&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=34369&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=34369&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=34369&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=34369&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=34369&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=34369&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=34369&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=34369&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=34369&r=mysqlcfg

Reply via email to