php-documentation-list | 2003031

[PHP-DOC] #22661 [Opn]: mysql_list_tables selects database From: georg <email protected>
Date: 03/12/03

 ID: 22661
 Updated by: georg <email protected>
 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

-- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php