Home > php教程 > php手册 > body text

初步了解PHP获取数据库表信息函数

WBOY
Release: 2016-06-13 11:09:18
Original
1096 people have browsed it

当我们利用

PHP获取数据库表信息函数之mysql_list_dbs()

resource mysql_list_dbs([resource link_id])
获取服务器上所有数据库名称.

举例:

  1. mysql_connect("localhost", "name","pwd");   
  2. $dbs = mysql_list_dbs();  
  3. while (list($db) = mysql_fetch_row(dbs)) {  
  4. echo "$db br>";  
  5. }  

注意,输出结果与使用的用户权限相关.

PHP获取数据库表信息函数之mysql_db_name()

string mysql_db_name(resource result_set, interger index)
获取在mysql_list_dbs()返回的result_set中位置为index的数据库名.

PHP获取数据库表信息函数之mysql_list_tables()

resource mysql_list_tables(string database [,resource link_id])
获取database中的所有表名.

PHP获取数据库表信息函数之mysql_tablename()

string mysql_tablename(resource result_set, interger index)
获取mysql_list_tables()返回的result_set中位置为index的表名.


source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!