#30311 [Opn->Bgs]: mysql can't find databases
| From: | derick@php.net | Date: | Sun, 03 Oct 2004 12:54:47 +0000 |
| Subject: | #30311 [Opn->Bgs]: mysql can't find databases | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-67050@lists.php.net to get a copy of this message | ||
ID: 30311
Updated by: derick@php.net
Reported By: alex at avannaproductions dot com
-Status: Open
+Status: Bogus
Bug Type: MySQL related
Operating System: MacOS X 10.3
PHP Version: 5.0.2
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
.
Previous Comments:
------------------------------------------------------------------------
[2004-10-02 20:22:52] alex at avannaproductions dot com
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 this bug report at http://bugs.php.net/?id=30311&edit=1