源代码如下:
<?php
mysql_connect(\"127.0.0.1\",\"root\",\"password\");
$tables = mysql_list_tables(\"information_schema\");
while (list($table) = mysql_fetch_row($tables)) {
echo \"$table <br />\";
}
?>
但由于mysql_fetch_row函数已经过时,因此运行上面代码会出现以下错误:
Deprecated: Function mysql_list_tables() is deprecated
我们可以使用mysql_query("SHOW TABLES FROM $data "); 代替mysql_fetch_row函数,因此正确是源代码如下:
<?php
mysql_connect(\"127.0.0.1\",\"root\",\"password\");
$tables = mysql_query(\"SHOW TABLES FROM information_schema\");
while (list($table) = mysql_fetch_row($tables)) {
echo \"$table <br />\";
}
?>
本示例获取本地数据库服务器上information_schema数据库的所有表名称,
继续阅读与本文标签相同的文章
上一篇 :
那些程序员小白还没掌握的30件事
下一篇 :
php 获取mysql版本的两种方法
-
Excel双色图表,年终总结用得着
2026-05-14栏目: 教程
-
苹果和Facebook竟因为一处房产而掐架
2026-05-14栏目: 教程
-
Windows 10 1909预计推送时间为11月12日
2026-05-14栏目: 教程
-
关于第四次工业革命的一些思考
2026-05-14栏目: 教程
-
HTTPS安全通信基础
2026-05-14栏目: 教程
