#22661 [Opn]: mysql_list_tables selects database
| From: | lucifer at vengeance dot et dot tudelft dot nl | Date: | Wed, 12 Mar 2003 16:46:52 +0000 |
| Subject: | #22661 [Opn]: mysql_list_tables selects database | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-35443@lists.php.net to get a copy of this message | ||
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 **<BR>"
$q = mysql_query( "show tables" );
while( $row = mysql_fetch_array( $q ) ) {
print $row[0]."<BR>";
}
$tables = mysql_list_tables( "db2" );
/* now db2 is selected */
print "** tables in selected database after mysql_list_tables **<BR>"
$q = mysql_query( "show tables" );
while( $row = mysql_fetch_array( $q ) ) {
print $row[0]."<BR>";
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=22661&edit=1