php gets the code for all the table names in the mysql database

  • 2020-05-05 11:03:52
  • OfStack

 
$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, which lists all the table names in mysql in php, has been deleted, and it is not recommended to use this function to list mysql data tables

Related articles: