A preliminary understanding of PHP's function to obtain database table information_PHP tutorial

WBOY
Release: 2016-07-15 13:32:37
Original
875 people have browsed it

When we use

PHP to obtain database table information function mysql_list_dbs()

resource mysql_list_dbs([resource link_id] )
Get the names of all databases on the server.

Example:

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

Note that the output results are related to the user permissions used.

One of the PHP functions to obtain database table information mysql_db_name()

string mysql_db_name(resource result_set, interger index)
Get the database name at index in the result_set returned by mysql_list_dbs().

PHP Get database table information function mysql_list_tables()

resource mysql_list_tables(string database [,resource link_id])
Get all table names in the database.

PHP Get database table information function mysql_tablename()

string mysql_tablename(resource result_set, interger index)
Get the table name at index in the result_set returned by mysql_list_tables().


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446139.htmlTechArticleWhen we use PHP to obtain database table information function mysql_list_dbs() resource mysql_list_dbs([resource link_id]) to obtain the server All database names. Example: mysql_connect(loca...
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 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!