php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #22661 mysql_list_tables selects database
Submitted: 2003-03-12 10:45 UTC Modified: 2003-03-13 02:47 UTC
From: lucifer at vengeance dot et dot tudelft dot nl Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.2.3 OS: PHP: WinXP MySQL: Win2k
Private report: No CVE-ID: None
 [2003-03-12 10:45 UTC] 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>";
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-12 10:46 UTC] 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 11:12 UTC] georg@php.net
Function should be marked as deprecated (like some others which have a sql command eviqualent)

You should use SHOW TABLES FROM DATABASE instead.
 [2003-03-13 02:47 UTC] georg@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 01:01:28 2024 UTC