Copy CodeThe 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, because the Mysql_list_tables method is obsolete, running the above program will give the method outdated hints, as follows:
Copy CodeThe code is as follows:
Deprecated:function mysql_list_tables () is Deprecated in ... on line xxx
One way to do this is to set the error_reporting in php.ini, without displaying the method obsolete prompt information
Copy CodeThe code is as follows:
error_reporting = E_all & ~e_notice & ~e_deprecated
Another option is to use PHP's official recommended alternative:
Copy CodeThe code is 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.html www.bkjia.com true http://www.bkjia.com/PHPjc/323840.html techarticle Copy the code code as follows: function List_tables ($database) {$rs = Mysql_list_tables ($database); $tables = Array (); while ($row = mysq L_fetch_row ($rs)) {$tables [] = $row [0];} mys ...