|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-10-03 14:54 UTC] derick@php.net
[2004-10-03 19:54 UTC] alex at sirensclef dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 02:00:01 2025 UTC |
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 ...