首页 > PHP教程 > php开发知识文章

php 获取MySQL中所有数据库的函数 -- mysql_list_dbs函数用法

本文主要介绍了php 获取MySQL中所有数据库的函数 -- mysql_list_dbs()函数用法。分享给大家供大家参考,欢迎大家的学习。

mysql_list_dbs()函数

resource mysql_list_dbs ([ resource $link_identifier ] )

列出MySQL服务器中所有的数据库

 

mysql_list_dbs() 函数返回一个结果指针,包含了当前 MySQL 进程中所有可用的数据库。

需要用 mysql_tablename() 函数来遍历此结果指针,或者任何使用结果表的函数,例如 mysql_fetch_array()。

 

$conn = @mysql_connect("localhost", "root", "123456") or die(mysql_error());
$db = mysql_list_dbs($conn);
while ($result = mysql_fetch_object($db)) {
echo $result->Database . "<br>";
}

以上就是本文php 获取MySQL中所有数据库的函数 -- mysql_list_dbs()函数用法的全部内容,希望本文所述对大家PHP程序设计有所帮助。

php 获取MySQL中所有数据库的函数 -- mysql_list_dbs()函数用法

关闭
感谢您的支持,我会继续努力!
扫码打赏,建议金额1-10元


提醒:打赏金额将直接进入对方账号,无法退款,请您谨慎操作。