<!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd "><HTMLxmlns= "http://www.w3.org/1999/xhtml"><Head><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" /><styletype= "Text/css"><!--body,table{font-size:13px;}Table{Table-layout:fixed;Emptyempty-cells:Show;Border-collapse:collapse;margin:0 Auto;Border:1px solid #cad9ea;}th{Height:22px;font-size:13px;Font-weight:Bold;Background-color:#CCCCCC;text-align:Center;}TD{Height:20px;}. Tabletitle{font-size:14px;Font-weight:Bold;}</style><title>Database structure</title></Head><Body><Divstyle= "margin:0 auto;width:880px; border:1px #006600 solid; font-size:12px; line-height:20px;"><Divstyle= "width:100%;height:30px; font-size:16px; font-weight:bold; text-align:center;">Network Database structure<BR/><Fontstyle= "font-size:14px; font-weight:normal;"><?php echo Date ("y-m-d h:i:s");?></Font></Div><?php$host = "localhost"; $username = "root"; $password = "root"; $dbname = "Ecsotre"; $dbconn =mysql_connect ($host, $ Username, $password); $sqlname = "Information_schema"; mysql_select_db ($sqlname, $dbconn); Session_Start (); $sql = " SELECT * from tables where table_schema= ' ". $dbname." ' ORDER by table_name '; $result = mysql_query ($sql); while ($row =mysql_fetch_array ($result)) {//print_r ($row);?> <Divstyle= "margin:0 auto; width:100%; padding-top:10px;"><bclass= "Tabletitle">Table Name:<?php echo $row ["table_name"]?> </b> <BR/><?php echo $row ["Table_comment"]?></Div> <Tablewidth= "100%"Border= "1"><thead><thwidth= "The ">Serial number</TD><thwidth= "The ">Field name</TD><thwidth= "$">Field type</TD><thwidth= "a">Allow to empty</TD><thwidth= "The ">Default value</TD><th>Note</TD></thead><?PHP$SQL2 = "SELECT * from columns where table_name= '". $row ["table_name"]. "' ORDER by column_name '; $result 2 = Mysql_que Ry ($sql 2); $num =0;while ($row 2=mysql_fetch_array ($result 2)) {$num = $num +1;//print_r ($row);?> <TR><TDAlign= "Center"><b><?php echo $num?></b></TD><TD><?php echo $row 2["column_name"]?></TD><TD><?php echo $row 2["Column_type"]?></TD><TDAlign= "Center"><?php echo $row 2["is_nullable"]?></TD><TDAlign= "Center"><?php echo $row 2["Column_default"]?></TD><TD><?php echo $row 2["Column_comment"]?></TD></TR><?php}?></Table><?Php}mysql_close ($dbconn);?></Div></Body></HTML>
PHP Get database structure