php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34324 mysql_select_db not honoring connection ids
Submitted: 2005-09-01 10:37 UTC Modified: 2005-09-01 10:43 UTC
From: ehassler at gmail dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5.0.4 OS: Windows 2000
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ehassler at gmail dot com
New email:
PHP Version: OS:

 

 [2005-09-01 10:37 UTC] ehassler at gmail dot com
Description:
------------
When maintaining two connections to the same mysql server mysql_select_db requests with the connection id supplied are setting both connections to use that database. 

Reproduce code:
---------------
$silver = mysql_connect('localhost','user','pass', true);
mysql_select_db('silver',$silver);
$lemon = mysql_connect('localhost','user','pass', true);
mysql_select_db('lemon',$lemon);
$silver_result = mysql_query('select * from errors') or print("The query has become invalid: \"".mysql_errno().": ".mysql_error()."\"");

var_dump($silver);
var_dump($lemon);

Expected result:
----------------
query should execute on silver.errors

Actual result:
--------------
I get an error that lemon.errors does not exist, even though both $silver and $lemon have different connection ids...

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-01 10:43 UTC] sniper@php.net
It might work if you passed the correct link to mysql_query().

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Dec 02 10:00:01 2025 UTC