ID:               32832
 Updated by:       [EMAIL PROTECTED]
 Reported By:      seusel73 at gmx dot de
-Status:           Open
+Status:           Bogus
 Bug Type:         MySQL related
 Operating System: Linux
 PHP Version:      4.3.10
 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.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.




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

[2005-04-26 11:40:40] seusel73 at gmx dot de

Description:
------------
The SHOW TABLES command doesn't work on the currently selected
database, but on the last selected one, even if that one has been
executed on a different connection handle.

In the example code, replace "host", "user", "password" with host, user
and password of your mysql server, and "test1", "test2" with two names
of two different databases on your mysql server - they should contain
tables with different names so you can detect a different listing.

The same problem comes up with "SHOW INDEX FROM table" and "SHOW
COLUMNS FROM table" :-( They always put out information from the second
db...

Exchanging mysql_connect with mysql_pconnect() doesn't change
anything.



php.ini is without surprise:

[MySQL]
mysql.allow_persistent  =   On
mysql.max_persistent    =   -1
mysql.max_links         =   -1
mysql.default_port      =
mysql.default_socket    =
mysql.default_host      =
mysql.default_user      =
mysql.default_password  =


The configureline shouldn't be problem either:

'./configure' '--prefix=/httpd' '--with-config-file-path=/httpd/lib'
'--with-apxs=/httpd/bin/apxs' '--with-informix=/informix' '--with-ttf'
'--with-ftp' '--with-sfw' '--with-hyperwave' '--with-snmp' '--with-bz2'
'--with-mime-magic' '--with-gdbm' '--with-inifile' '--with-flatfile'
'--enable-bcmath' '--enable-calendar' '--enable-sockets' '--enable-dba'
'--enable-wddx' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm'
'--enable-trans-sid' '--enable-safe-mode' '--enable-memory-limit'
'--enable-inline-optimization' '--enable-magic-quotes'
'--with-zlib=yes' '--with-gd=yes' '--with-unixODBC=/usr/lib'
'--with-jpeg-dir=/usr/lib' '--with-png-dir=/usr/lib'
'--with-tiff-dir=/usr/lib' '--with-imap' '--with-ssl=/usr'
'--with-imap-ssl=/usr' '--with-openssl=/usr'

Reproduce code:
---------------
function connect ($name) {
        $res = @mysql_connect ("host", "user", "password");
        mysql_select_db ($name, $res); return $res; }
function list_tables ($db) {    
        if ($retv = @mysql_query ("SHOW TABLES", $db)) {
                $res = array();
                while ($v = @mysql_fetch_assoc ($retv)) {
                        foreach ($v as $idx => $name) {
                                $s = $name; break; }
                        $res[] = $s; }
                @mysql_free_result ($retv); }
        return $res; }

$db1 = connect ("test1"); $db2 = connect ("test2");
$qr1 = list_tables ($db1); $qr2 = list_tables ($db2);
@mysql_close ($db1); @mysql_close ($db2);
var_dump ($qr1); var_dump ($qr2);


Expected result:
----------------
List of names of tables in database "test1" and "test2"

Actual result:
--------------
List of names of tables in database "test2" - twice


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


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

Reply via email to