From:             alex at avannaproductions dot com
Operating system: MacOS X 10.3
PHP version:      5.0.2
PHP Bug Type:     MySQL related
Bug description:  mysql can't find databases

Description:
------------
I have PHP 5.0.2 and MySQL 4.1.4 installed. Both mysql 
and mysqli extensions are enabled. Currently I have 5 
databases created. However, when I try to access them 
through PHP, mysql seems to think there is only 1, 
whereas mysqli finds all 5. I originally noticed this 
when I suddenly could no longer select a db I wanted 
with mysql. Upon investigating further, I came up with 
the following reproduce code that fails to find more 
than 1 db using mysql in either of 2 different methods. 
Then succeeds in finding all 5 with mysqli.

Configure option: --with-mysql=/usr/local/mysql --with-
mysqli=/usr/local/mysql/bin/mysql_config

Reproduce code:
---------------
$db=mysql_connect("HOST","USER","PASSWORD");
$db_list=mysql_list_dbs($db);
$count=mysql_num_rows($db_list);
for($i=0;$i<$count;$i++) echo mysql_db_name($db_list,$i)."<br>";

echo "----<br>";

$db=mysql_connect("HOST","USER","PASSWORD");
$res=mysql_query("SHOW DATABASES;");
if ($res) while ($res2=mysql_fetch_assoc($res)) echo
$res2["Database"]."<br>";

echo "----<br>";

$db=new mysqli("HOST","USER","PASSWORD","ANY DB");
$res=$db->query("SHOW DATABASES;");
if ($res) while ($res2=$res->fetch_assoc()) echo $res2["Database"]."<br>";

Expected result:
----------------
db 1
db 2
db 3
...
----
db 1
db 2
db 3
...
----
db 1
db 2
db 3
...

Actual result:
--------------
db 4
----
db 4
----
db 1
db 2
db 3
...

-- 
Edit bug report at http://bugs.php.net/?id=30311&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=30311&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30311&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30311&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=30311&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=30311&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=30311&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=30311&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=30311&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=30311&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=30311&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=30311&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=30311&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=30311&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=30311&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=30311&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=30311&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=30311&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=30311&r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=30311&r=mysqlcfg

Reply via email to