#22661 [Opn]: mysql_list_tables selects database
| From: | georg@php.net | Date: | Wed, 12 Mar 2003 17:12:53 +0000 |
| Subject: | #22661 [Opn]: mysql_list_tables selects database | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969352192@lists.php.net to get a copy of this message | ||
ID: 22661
Updated by: georg@php.net
Reported By: lucifer at vengeance dot et dot tudelft dot nl
Status: Open
-Bug Type: MySQL related
+Bug Type: Documentation problem
Operating System: PHP: WinXP MySQL: Win2k
PHP Version: 4.2.3
New Comment:
Function should be marked as deprecated (like some others which have a
sql command eviqualent)
You should use SHOW TABLES FROM DATABASE instead.
Previous Comments:
------------------------------------------------------------------------
[2003-03-12 10:46:51] lucifer at vengeance dot et dot tudelft dot nl
sorry for the parsing errors in the example; i saw them too late :)
------------------------------------------------------------------------
[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