Copy code The code is as follows:
function list_tables($database)
{
$rs = mysql_list_tables($database) ;
$tables = array();
while ($row = mysql_fetch_row($rs)) {
$tables[] = $row[0];
}
mysql_free_result($ rs);
return $tables;
}
However, since the mysql_list_tables method is obsolete, when running the above program, an obsolete method prompt message will be given, as follows:
Copy code The code is as follows:
Deprecated: Function mysql_list_tables() is deprecated in … on line xxx
a The solution is to set error_reporting in php.ini and not display the method obsolescence prompt message
Copy the code The code is as follows:
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED
Another method is to use the official PHP recommended alternative:
Copy code Code As follows:
function list_tables($database)
{
$rs = mysql_query("SHOW TABLES FROM $database");
$tables = array();
while ($row = mysql_fetch_row($rs)) {
$tables[] = $row[0];
}
mysql_free_result($rs);
return $tables;
}
http://www.bkjia.com/PHPjc/323840.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/323840.htmlTechArticleCopy the code The code is as follows: function list_tables($database) { $rs = mysql_list_tables($database); $tables = array(); while ($row = mysql_fetch_row($rs)) { $tables[] = $row[0]; } mys...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn