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 out of date, a prompt message indicating that the method is out of date is displayed when you run the above program, as shown below:
Copy codeThe Code is as follows:
Deprecated: Function mysql_list_tables () is deprecated in... On line xxx
One solution is to set error_reporting in php. ini without displaying the method outdated prompt.
Copy codeThe Code is as follows:
Error_reporting = E_ALL &~ E_NOTICE &~ E_DEPRECATED
Another method is to use the alternative method officially recommended by PHP:
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;
}