Home  >  Article  >  Backend Development  >  How to list all databases of mysql server mysql_db_name_PHP tutorial

How to list all databases of mysql server mysql_db_name_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:04:011292browse

How to list all databases of mysql server mysql_db_name

Definition and usage
The mysql_db_name() function takes the name of the database from which the mysql_list_dbs() function is called.

This function returns the database name on success, or FALSE on failure.

Grammar

mysql_db_name(list,row,field)

list 必需的。结果指针指定的mysql_list_dbs ( )函数
row 必需的。指定哪些行指数的结果指针返回。始于零。
field 可以,数据库名
来看看mysql_db_name的实例吧.
<?
<pre class="brush:php;toolbar:false">$db_list = mysql_list_dbs($con);
$i = 0;
$db_count = mysql_num_rows($db_list);
while ($i < $db_count) 
  {
  echo mysql_db_name($db_list, $i) . "<br />";
  $i++;
  }
?>
 
输出结果是你当前服务器的所有数据库哦.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/630898.htmlTechArticleHow to list all databases of mysql server mysql_db_name Definition and Usage The mysql_db_name() function thinks that mysql_list_dbs is called from the database name ( ) function. This function...
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