ID:               38689
 User updated by:  nerdystudmuffin at gmail dot com
 Reported By:      nerdystudmuffin at gmail dot com
 Status:           Bogus
 Bug Type:         MySQL related
 Operating System: Linux, XP, NT, 2K
 PHP Version:      5.1.6
 New Comment:

What a waste of your time, I'm sorry I scoured Google and other
resources for this issue and didn't find it anywhere. My fellow
programmers locally were all scratching their heads ... even IRC had no
answers(rarely has anything of value these days). 

[QUOTE]
this is actually the expected behaviuor.
use the 4th parameter of mysql_connect see :
[/QUOTE]

This fixed my problem. Thank you for the solution. The logic behind
this makes sense although it wasn't expected behavior. I will now
attempt to remove my ass-hat ;)

Cheers!


Previous Comments:
------------------------------------------------------------------------

[2006-09-02 06:38:47] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php



------------------------------------------------------------------------

[2006-09-02 05:13:14] judas dot iscariote at gmail dot com

this is actually the expected behaviuor.

use the 4th parameter of mysql_connect see :

http://php.net/manual/en/function.mysql-connect.php

not a bug, but a feature. ;)

------------------------------------------------------------------------

[2006-09-02 05:07:13] nerdystudmuffin at gmail dot com

Description:
------------
Generating two database handles to the same server with the same
authentication and selecting different databases for them. They act as
a single connection and will only return results from the last database
selected.

Reproduce code:
---------------
$server ="localhost";
$user="sql_admin";
$pass="password";
$num_query = "SELECT * FROM aqs_users WHERE 1";
$num_db = "aqs";
$anum_query = "SELECT * FROM w_dagent_hierarchy WHERE
row_date='2005-08-08'";
$anum_db = "dbviews";
$num = mysql_connect($server,$user,$pass);
$anum = mysql_connect($server,$user,$pass);
### LINEAR
mysql_select_db($num_db,$num);
mysql_select_db($anum_db,$anum);
$num_res = mysql_query($num_query,$num);
$anum_res = mysql_query($anum_query,$anum);
$num_row = mysql_fetch_row($num_res);
$anum_row = mysql_fetch_row($anum_res);
echo "<pre>"; print_r($num_row); echo "</pre>";
echo "<pre>"; print_r($anum_row); echo "</pre>";
mysql_close($num); mysql_close($anum); unset($num_res);
unset($anum_res); unset($num_row); unset($anum_row);
echo "<hr>";
$num = mysql_connect($server,$user,$pass);
$anum = mysql_connect($server,$user,$pass);
mysql_query("USE aqs",$num);
mysql_query("USE dbviews",$anum);
$num_res = mysql_query($num_query,$num);
$anum_res = mysql_query($anum_query,$anum);
$num_row = mysql_fetch_row($num_res);
$anum_row = mysql_fetch_row($anum_res);
echo "<pre>"; print_r($num_row); echo "</pre>";
echo "<pre>"; print_r($anum_row); echo "</pre>";
mysql_close($num); mysql_close($anum); unset($num_res);
unset($anum_res); unset($num_row); unset($anum_row);

Expected result:
----------------
I would expect both querys to run and display a formatted print_r() of
the results.

Actual result:
--------------
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL
result resource in D:\AQS\testme.php on line 64

Array
(
    [0] => 1
    [1] => CENSORED
    [2] => CENSORED
    [3] => 15
    [4] => 0
    [5] => 4
)


Warning: mysql_fetch_row(): supplied argument is not a valid MySQL
result resource in D:\AQS\testme.php on line 82

Array
(
    [0] => 2005-08-08
    [1] => 0011f25.0000010
    [2] => 2300
    [3] => CENSORED
    [4] => 
    [5] => CENSORED
    [6] => CENSORED
    [7] => 0021d02.0000004
    [8] => Mid
    [9] => CENSORED
    [10] => CENSORED
    [11] => Full-time
    [12] => CENSORED
    [13] => 2003-12-08
    [14] => 0000-00-00
)



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=38689&edit=1

Reply via email to