在
要查询系统中都存在哪些数据库,可使用mysql_list_dbs()函数,其语法格式如下:
resource mysql_list_dbs ([ resource $link_identifier ] )
mysql_list_dbs()函数返回的结果集中包含了mysql服务器中所有的数据库,php获得所有数据库示例如下:
?php $connection=mysql_connect(localhost,root
,root) or die(连接服务器失败); $db_list = mysql_list_dbs($connection); while ($row = mysql_fetch_object
($db_list)) { echo $row->database . br>; echo hr>; } mysql_close($connection); ?>
在上面php获得所有数据库代码中,循环输出结果集时用到了mysql_fetch_object()函数,mysql_fetch_object()函数和mysql_fetch_array()函数用法类似,不同的是 mysql_fetch_array()函数返回一个数组,而mysql_fetch_object()函数则返回一个对象。 mysql_fetch_object()函数的语法格式如下:
object mysql_fetch_object ( resource $result )
http://www.bkjia.com/phpjc/445933.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/445933.htmltecharticle在 要查询系统中都存在哪些数据库,可使用mysql_list_dbs()函数,其语法格式如下: resource mysql_list_dbs ([ resource $link_identifier ] ) mysql_list_dbs(...