Home >Backend Development >PHP Tutorial >php lists all tables in the database specified by mysql

php lists all tables in the database specified by mysql

WBOY
WBOYOriginal
2016-07-25 08:42:55735browse

php lists all tables in the database specified by mysql

  1. if (!function_exists('mysql_list_db_tables')) {
  2. function mysql_list_db_tables($database) {
  3. $tables = Array();
  4. $resul ts = mysql_query('SHOW TABLES FROM ' . $database);
  5. while($row = @mysql_fetch_assoc($results)) { $tables[] = $row['Tables_in_' . $database]; }
  6. return $tables;
  7. }
  8. }
Copy code

Database, php, mysql


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