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

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

WBOY
WBOYOriginal
2016-06-01 12:16:341020browse
复制代码 代码如下:
$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数据表
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