PHP--Database information

Source: Internet
Author: User

-----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> $

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.