Sometimes we get other people's database, but there is no data dictionary, this PHP applet to help you easily solve.
Code is found on the web, of course, this code is only generated data dictionary, view, stored procedures and so on is wood.
$v) {$sql = ' SELECT * from '; $sql. = ' Information_schema. TABLES '; $sql. = ' WHERE '; $sql. = "table_name = ' {$v [' table_name ']} ' and Table_schema = ' {$database} '"; $table _result = mysql_query ($sql, $mysql _conn); while ($t = mysql_fetch_array ($table _result)) {$tables [$k] [' table_comment '] = $t [' table_comment ']; } $sql = ' SELECT * from '; $sql. = ' Information_schema. COLUMNS '; $sql. = ' WHERE '; $sql. = "table_name = ' {$v [' table_name ']} ' and Table_schema = ' {$database} '"; $fields = Array (); $field _result = mysql_query ($sql, $mysql _conn); while ($t = mysql_fetch_array ($field _result)) {$fields [] = $t; } $tables [$k] [' COLUMN '] = $fields;} Mysql_close ($mysql _conn); $html = ";//Loop All tables foreach ($tables as $k = = $v) {//$html. = ''. $v [' table_comment ']. '
'; $html. = '
'; $html. = '
. $v [' table_name ']. ' '. $v [' table_comment ']. '
'; $html. = '
Field name |
Data Type |
Default Value |
allow non-null |
Auto Increment |
Notes |
'; $html. = '; foreach ($v [' COLUMN '] as $f) {$html. = '
' . $f [' column_name ']. ' | '; $html. = '
' . $f [' Column_type ']. ' | '; $html. = '
' . $f [' Column_default ']. ' | '; $html. = '
' . $f [' is_nullable ']. ' | '; $html. = '
' . ($f [' EXTRA ']== ' auto_increment '? ' Is ': '). ' | '; $html. = '
' . $f [' column_comment ']. ' | '; $html. = '
'; } $html. = '
';} Output echo '
<title>'. $title. '</title>'; Echo '
'. $title. '
"Echo $html; echo."';? >
Results after the run:
http://www.bkjia.com/PHPjc/664292.html www.bkjia.com true http://www.bkjia.com/PHPjc/664292.html techarticle Sometimes we get other people's database, but there is no data dictionary, this PHP applet to help you easily solve. The code is found online, of course, this code is only generated data word ...