PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<mysql_data_seekmysql_db_query>
Last updated: Mon, 16 Jul 2012

mysql_db_name

(PHP 3 >= 3.0.6, PHP 4, PHP 5)

mysql_db_name -- 取得结果数据

说明

string mysql_db_name ( resource result, int row [, mixed field] )

mysql_db_name() 将调用 mysql_list_dbs() 返回的结果指针作为第一个参数。row 参数是结果集中的一个索引。

如果出错则返回 FALSE。用 mysql_errno()mysql_error() 来确定错误的种类。

例子 1. mysql_db_name() 例子

<?php
   error_reporting
(E_ALL);

  
mysql_connect('dbhost', 'username', 'password');
  
$db_list = mysql_list_dbs();

  
$i = 0;
  
$cnt = mysql_num_rows($db_list);
   while (
$i < $cnt) {
       echo
mysql_db_name($db_list, $i) . "\n";
      
$i++;
   }
?>

为向下兼容也可以用 mysql_dbname()。但并不提倡。




<mysql_data_seekmysql_db_query>
 Last updated: Mon, 16 Jul 2012
 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://manual.phpv.net/
Last updated: Thu Jul 7 19:13:47 2005 CST