Bug #17102: mysql_query queries incorrect database
| From: | mah18 at i-2000 dot com | Date: | Wed, 08 May 2002 19:48:31 +0000 |
| Subject: | Bug #17102: mysql_query queries incorrect database | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-7261@lists.php.net to get a copy of this message | ||
From: mah18@i-2000.com
Operating system: linux redhat 7.2
PHP version: 4.1.2
PHP Bug Type: MySQL related
Bug description: mysql_query queries incorrect database
I'm using a class for my database queries. In my code I am querying two
different databases with different usernames and passwords (I am aware an
existing problem that occurs when the usernames and passwords are the
same). For some reason, often under heavy load, mysql_query queries the
wrong database (looks for table in wrongdatabase.table), even though the
connection_id and database are correct, and even though I force it to
select the database again (also happens when the mysql_select_db line is
commented out).
function sql_query(&$sql_db, $query="") {
// Constructor of the query object.
// executes the query
if(!empty($query) && !empty($sql_db->connect_id)){
$connectdb = mysql_select_db($sql_db->database,
$sql_db->connect_id); // force it to select database
$this->result=@mysql_query($query, $sql_db->connect_id) or
die($this->error($query,$sql_db->connect_id,$sql_db->database));
return $this->result;
}
}
--
Edit bug report at http://bugs.php.net/?id=17102&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=17102&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=17102&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=17102&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=17102&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=17102&r=support
Expected behavior: http://bugs.php.net/fix.php?id=17102&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=17102&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=17102&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=17102&r=globals