To display all table names in a specified database in mysql, we have a command SHOW TABLES to achieve it. Let me take a look at how SHOW TABLES obtains all table names in the mysql database.
Use directly in cmd command mode
The code is as follows
|
Copy code
|
||||
show tables from db_name; |
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 that the function mysql_list_tables for all table names in the PHP list mysql has been deleted. It is recommended not to use this function list mysql data table
http://www.bkjia.com/PHPjc/630721.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/630721.htmlTechArticleIn mysql, if you want to display all the table names in the specified database, we have a command SHOW TABLES to achieve it. Let me do it below Take a look at how SHOW TABLES obtains all table names in the mysql database. ...
|
|