php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17102 mysql_query queries incorrect database
Submitted: 2002-05-08 15:48 UTC Modified: 2002-08-08 01:00 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: mah18 at i-2000 dot com Assigned:
Status: No Feedback Package: MySQL related
PHP Version: 4.1.2 OS: linux redhat 7.2
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mah18 at i-2000 dot com
New email:
PHP Version: OS:

 

 [2002-05-08 15:48 UTC] mah18 at i-2000 dot com
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;
    }
  }

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-07 22:24 UTC] sniper@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.




And before all that, try this snapshot:

http://snaps.php.net/php4-latest.tar.gz


 [2002-08-08 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 22:01:26 2024 UTC