In MySQL to display all the table names in the specified database we have a command show tables can be implemented, let me take a look at how show tables get all the table names in the MySQL database.
Use Direct cmd command mode
The code is as follows |
Copy Code |
show databases; Show tables from db_name;
Show columns from table_name to db_name; Show index from Talbe_name [from db_name]; Show status; Show variables; Show [Full] processlist; Show table status [from db_name]; Show grants for user; |
Combined with PHP MySQL database
The code is as follows |
Copy Code |
$server = ' localhost '; $user = ' root '; $pass = "; $dbname = ' dayanmei_com '; $conn = mysql_connect ($server, $user, $pass); if (! $conn) Die ("Database system Connection Failed! "); mysql_select_db ($dbname) or Die ("Database connection failed! "); $result = mysql_query ("SHOW TABLES"); while ($row = Mysql_fetch_array ($result)) { echo $row [0]. ""; Mysql_free_result ($result); } |
Note the PHP list of all table names in MySQL function mysql_list_tables, has been deleted, it is recommended not to use the function list MySQL data table
http://www.bkjia.com/PHPjc/630721.html www.bkjia.com true http://www.bkjia.com/PHPjc/630721.html techarticle in MySQL to display all the table names in the specified database we have a command show tables can be implemented, let me take a look at how show tables get all the table names in the MySQL database. ...