MySQL List Database Tables


/ Published in: PHP
Save to your folder(s)

Fetch a list of tables in a specific database.


Copy this code and paste it in your HTML
  1. if (!function_exists('mysql_list_db_tables')) {
  2.  
  3. function mysql_list_db_tables($database) {
  4.  
  5. $tables = Array();
  6.  
  7. $results = mysql_query('SHOW TABLES FROM ' . $database);
  8. while($row = @mysql_fetch_assoc($results)) { $tables[] = $row['Tables_in_' . $database]; }
  9.  
  10. return $tables;
  11.  
  12. }
  13.  
  14. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.