-----023-dbinfo.php-----
1<! DOCTYPE html>234<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">5<title>mysql Database Information </title>67<body>89<pre style= "font-family: Microsoft ya black; Font-size:14pt ">Ten<?PHP One /* A mysql_connect () performing a connection - mysql_query () Execute SQL statement - mysql_result (Resource, row, [column]) query specific data the mysql_num_rows () returns the number of rows - Mysql_num_fields () returns the number of columns - Mysql_fetch_row|assoc|array Returns a row, the pointer moves back - Mysql_fetch_field ($result, column index) returns column information + */ - + $con= @mysql_connect("localhost", "root", "root") or die("Connection Failed"); A //$dblist = Mysql_list_dbs ($con); system not recommended at $dblist=mysql_query("SHOW DATABASES"); - Echo"Shared database:",mysql_num_rows($dblist), "A." \ n "; - while($s=Mysql_fetch_row($dblist)) - Echo $s[0], ","; - Echo"\ n"; - in mysql_query("Use the World"); - $tblist=mysql_query("SHOW TABLES"); to Echo"Total data sheet:",mysql_num_rows($tblist), "A." \ n "; + while($s=Mysql_fetch_row($tblist)) - Echo $s[0], ""; the Echo"\ n A third table:",Mysql_result($tblist, 2, 0), "\ n"; * $ $result=mysql_query("SELECT * FROM Country");Panax Notoginseng $s=Mysql_fetch_field($result, 5); - Echo"Data sheet in common",Mysql_num_fields($result), "Column \ n"; the Echo"Field information for column sixth:",Var_export($s), "\ n"; + Echo"Column length:",Mysql_field_len($result, 5), "\ n"; A Echo"Column name:",Mysql_field_name($result, 5), "\ n"; the Echo"Column data type:",Mysql_field_type($result, 5), "\ n"; +?> -</pre> $</body> $