新聞中心
當(dāng)我們利用PHP編程時,需要操作數(shù)據(jù)庫的話,將會用到mysql函數(shù)。這個函數(shù)包含的內(nèi)容有很多,我們下面將會介紹的是有關(guān)PHP獲取數(shù)據(jù)庫表信息函數(shù)的一些內(nèi)容。#t#

PHP獲取數(shù)據(jù)庫表信息函數(shù)之mysql_list_dbs()
resource mysql_list_dbs([resource link_id])
獲取服務(wù)器上所有數(shù)據(jù)庫名稱.
舉例:
- mysql_connect("localhost", "name","pwd");
- $dbs = mysql_list_dbs();
- while (list($db) = mysql_fetch_row(dbs)) {
- echo "$db
"; - }
注意,輸出結(jié)果與使用的用戶權(quán)限相關(guān).
PHP獲取數(shù)據(jù)庫表信息函數(shù)之mysql_db_name()
string mysql_db_name(resource result_set, interger index)
獲取在mysql_list_dbs()返回的result_set中位置為index的數(shù)據(jù)庫名.
PHP獲取數(shù)據(jù)庫表信息函數(shù)之mysql_list_tables()
resource mysql_list_tables(string database [,resource link_id])
獲取database中的所有表名.
PHP獲取數(shù)據(jù)庫表信息函數(shù)之mysql_tablename()
string mysql_tablename(resource result_set, interger index)
獲取mysql_list_tables()返回的result_set中位置為index的表名.
分享標(biāo)題:初步了解PHP獲取數(shù)據(jù)庫表信息函數(shù)
分享路徑:http://fisionsoft.com.cn/article/dppoeoh.html


咨詢
建站咨詢
