In
To query which databases exist in the system, you can use the Mysql_list_dbs () function, which has the following syntax format:
Resource Mysql_list_dbs ([Resource $link _identifier])
The result set returned by the Mysql_list_dbs () function contains all the databases in the MySQL server, and PHP obtains all the database examples as follows:
- < ? PHP
- $ Connection = mysql_connect ("localhost", "root"
, "root") or Die ("Connection Server failed");
- $ db_list = Mysql_list_dbs ($connection);
- While ($row = mysql_fetch_object
($db _list)) {
- Echo $row- > Database. "< br>";
- echo " < hr>";
- }
- Mysql_close ($connection);
- ?>
In the above PHP get all the database code, the loop output result set used the Mysql_fetch_object () function, mysql_fetch_object () function and mysql_fetch_array () function usage similar, different is Mysql_ The Fetch_array () function returns an array, and the Mysql_fetch_object () function returns an object. The syntax format for the mysql_fetch_object () function is as follows:
Object Mysql_fetch_object (Resource $result)
http://www.bkjia.com/PHPjc/445933.html www.bkjia.com true http://www.bkjia.com/PHPjc/445933.html techarticle in order to query which databases exist in the system, you can use the Mysql_list_dbs () function, which has the following syntax: Resource Mysql_list_dbs ([Resource $link _identifier]) mysql_list _dbs ( ...