|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2002-05-18 08:16 UTC] vania at fe dot up dot pt
 It seems that DB.php cannot handle different connections for SQL Server. I noticed that you fixed this for MySQL. 
In mysql.php you have this:
 if ($dsninfo['database']) {
            // fix to allow calls to different databases in 
            the same script
            if (empty($GLOBALS['_DB_mysql_changed_database'])) {
                $this->_changed_db = false;
                if (!@mysql_select_db($dsninfo['database'], $conn)) {
                    return $this->raiseError(DB_ERROR_NODBSELECTED, null, null, null, mysql_error($conn));
                }
            } else {
                $GLOBALS['_DB_mysql_changed_database'] = true;
                $this->_changed_db = $dsninfo['database'];
            }
        }
And in mssql.php it's only this:
        if ($dsninfo['database']) {
            if (!@mssql_select_db($dsninfo['database'], $conn)) {
                return $this->raiseError(DB_ERROR_NODBSELECTED, null, null, null, mssql_get_last_message());
            }
        }
In my scripts I noticed that it handles only the last connection made and ignores queries with the other objects created to access database.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 08:00:01 2025 UTC | 
Hi, i am running w2k php 4.2 too. $conn1 = mysql_connect("localhost", "user", "pass"); $conn2 = mysql_connect("localhost", "user", "pass"); mysql_select_db("test1" , $conn1); mysql_select_db("test2" , $conn2); // it sets the db for $conn1 and $conn2!!! NOT only for $conn2 $sql = "SELECT * FROM test"; $result1 = mysql_query($sql, $conn1); $result2 = mysql_query($sql, $conn2); $result1 is the same as $result2!!!!!!!!!