<?php
/**
* 生成mysql資料字典
*/
//配置資料庫
$dbserver = "127.0.0.1";
$dbusername = "賬號";
$dbpassword = "密碼";
$database = "資料庫";
//其他配置
$title = '資料字典';
$mysql_conn = @mysql_connect("$dbserver", "$dbusername", "$dbpassword") or die("mysql connect is error.");
mysql_select_db($database, $mysql_conn);
mysql_query('set names utf8', $mysql_conn);
$table_result = mysql_query('show tables', $mysql_conn);
//取得所有的表名
while ($row = mysql_fetch_array($table_result))
//迴圈取得所有表的備註及表中列訊息
foreach ($tables as $k=>$v) ' and table_schema = ''";
$table_result = mysql_query($sql, $mysql_conn);
while ($t = mysql_fetch_array($table_result) )
$sql = 'select * from ';
$sql .= 'information_schema.columns ';
$sql .= 'where ';
$sql .= "table_name = '' and table_schema = ''";
$fields = array();
$field_result = mysql_query($sql, $mysql_conn);
while ($t = mysql_fetch_array($field_result) )
$tables[$k]['column'] = $fields;
} mysql_close($mysql_conn);
$html = '';
//迴圈所有表
foreach ($tables as $k=>$v)
$html .= '
';
} //輸出
echo '';
echo '';
echo $html;
echo '
';
?>
php生成資料字典
生成mysql資料字典 配置資料庫 dbserver 127.0.0.1 dbusername 賬號 dbpassword 密碼 database 資料庫 其他配置 title 資料字典 mysql conn mysql connect dbserver dbusername dbpassword ...
sqlserver 生成資料字典
1,select obj.name as 表名,col.colorder as 序號 col.name as 列名 isnull ep.value as 列說明 t.name as 資料型別 col.length as 長度 isnull columnproperty col.id,col.name...
PHP使用mysqli函式生成資料字典
生成mysql資料字典 配置資料庫 dbserver 資料庫位址 dbusername 使用者名稱 dbpassword 使用者密碼 database 資料庫名 其他配置 title 資料字典 mysql conn mysqli connect dbserver dbusername dbpassw...