Home  >  Article  >  Backend Development  >  php获取mysql数据库中的所有表名的代码

php获取mysql数据库中的所有表名的代码

PHP中文网
PHP中文网Original
2017-03-23 10:22:505234browse

php获取mysql数据库中的所有表名的代码

 代码如下:

$server = 'localhost'; 
$user = 'root'; 
$pass = ''; 
$dbname = 'dayanmei_com'; 
$conn = mysql_connect($server,$user,$pass); 
if(!$conn) die("数据库系统连接失败!"); 
mysql_select_db($dbname) or die("数据库连接失败!"); 
$result = mysql_query("SHOW TABLES"); 
while($row = mysql_fetch_array($result)) 
{ 
echo $row[0].""; 
} 
mysql_free_result($result);

注意php中列表mysql中所有表名的函数mysql_list_tables,已经删除了,建议不要使用该函数列表mysql数据表

以上就是php获取mysql数据库中的所有表名的代码_php技巧的内容,更多相关内容请关注PHP中文网(m.sbmmt.com)!

相关文章:

PHP获取mysql数据库表字段的方法

PHP获取MySQL数据库里所有表的实现代码

php获取mysql数据库版本号 mysql_get_server_info

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