#22661 [Opn]: mysql_list_tables selects database

2003-03-12 Thread lucifer at vengeance dot et dot tudelft dot nl
 ID:   22661
 User updated by:  lucifer at vengeance dot et dot tudelft dot nl
 Reported By:  lucifer at vengeance dot et dot tudelft dot nl
 Status:   Open
 Bug Type: MySQL related
 Operating System: PHP: WinXP MySQL: Win2k
 PHP Version:  4.2.3
 New Comment:

sorry for the parsing errors in the example; i saw them too late :)


Previous Comments:


[2003-03-12 10:45:33] lucifer at vengeance dot et dot tudelft dot nl

the function "mysql_list_tables" changes the database subsequent
queries will run on; an example:

$link = mysql_connect( "host", "user", "password" );
mysql_select_db( "db1", $link );

/* now db1 is selected */
print "** tables in selected database before mysql_list_tables **"
$q = mysql_query( "show tables" );
while( $row = mysql_fetch_array( $q ) ) {
  print $row[0]."";
}

$tables = mysql_list_tables( "db2" );

/* now db2 is selected */
print "** tables in selected database after mysql_list_tables **"
$q = mysql_query( "show tables" );
while( $row = mysql_fetch_array( $q ) ) {
  print $row[0]."";
}





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



#22661 [NEW]: mysql_list_tables selects database

2003-03-12 Thread lucifer at vengeance dot et dot tudelft dot nl
From: lucifer at vengeance dot et dot tudelft dot nl
Operating system: PHP: WinXP MySQL: Win2k
PHP version:  4.2.3
PHP Bug Type: MySQL related
Bug description:  mysql_list_tables selects database

the function "mysql_list_tables" changes the database subsequent queries
will run on; an example:

$link = mysql_connect( "host", "user", "password" );
mysql_select_db( "db1", $link );

/* now db1 is selected */
print "** tables in selected database before mysql_list_tables **"
$q = mysql_query( "show tables" );
while( $row = mysql_fetch_array( $q ) ) {
  print $row[0]."";
}

$tables = mysql_list_tables( "db2" );

/* now db2 is selected */
print "** tables in selected database after mysql_list_tables **"
$q = mysql_query( "show tables" );
while( $row = mysql_fetch_array( $q ) ) {
  print $row[0]."";
}

-- 
Edit bug report at http://bugs.php.net/?id=22661&edit=1
-- 
Try a CVS snapshot: http://bugs.php.net/fix.php?id=22661&r=trysnapshot
Fixed in CVS:   http://bugs.php.net/fix.php?id=22661&r=fixedcvs
Fixed in release:   http://bugs.php.net/fix.php?id=22661&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=22661&r=needtrace
Try newer version:  http://bugs.php.net/fix.php?id=22661&r=oldversion
Not developer issue:http://bugs.php.net/fix.php?id=22661&r=support
Expected behavior:  http://bugs.php.net/fix.php?id=22661&r=notwrong
Not enough info:http://bugs.php.net/fix.php?id=22661&r=notenoughinfo
Submitted twice:http://bugs.php.net/fix.php?id=22661&r=submittedtwice
register_globals:   http://bugs.php.net/fix.php?id=22661&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22661&r=php3
Daylight Savings:   http://bugs.php.net/fix.php?id=22661&r=dst
IIS Stability:  http://bugs.php.net/fix.php?id=22661&r=isapi
Install GNU Sed:http://bugs.php.net/fix.php?id=22661&r=gnused