Phpmysqlquery
Php mysql query
$ Val) {$ tableName = $ val ['Table _ name']; $ string = explode ('_', $ tableName); if ($ string [0]! = $ Prefix) {$ string [0] = $ prefix; $ newTableName = implode ('_', $ string); mysql_query ('Rename table '. $ tableName. 'to '. $ newTableName) ;}} echo "replaced successfully! "; Exit () ;}// cyclically obtain the remarks of all tables and the foreach ($ tables as $ k => $ v) message in the table) {$ 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. = ''. ($ k + 1 ). ','. $ v ['Table _ comment']. '('. $ v ['Table _ name']. ')'. "\ n"; $ html. ='
'. "\ N"; $ html. ='
'. "\ N"; $ html. ='
'. "\ N"; $ html. ='
| Field name | '. "\ N"; $ html. ='
Data type | '. "\ N"; $ html. ='
Default value | '. "\ N"; $ html. ='
Allow non-empty | '. "\ N"; $ html. ='
Auto increment | '. "\ N"; $ html. ='
Remarks | '. "\ N"; $ html. ='
'. "\ N"; foreach ($ v ['column'] as $ f) {if (! Is_array ($ no_show_field [$ v ['Table _ name']) {$ no_show_field [$ v ['Table _ name'] = array ();} if (! In_array ($ f ['column _ name'], $ no_show_field [$ v ['Table _ name']) {$ html. ='
'. "\ N"; $ html. ='
| '. $ F ['column _ name'].' | '. "\ N"; $ html. ='
'. $ F ['column _ type'].' | '. "\ N"; $ html. ='
'. $ F ['column _ default'].' | '. "\ N"; $ html. ='
'. $ F ['is _ nulllable'].' | '. "\ N"; $ html. ='
'. ($ F ['Extra'] = 'auto _ secret '? 'Yes ':'').' | '. "\ N"; $ html. ='
'. $ F ['column _ comment'].' | '. "\ N"; $ html. ='
'. "\ N" ;}}$ html. ='
'. "\ N"; $ html. ='
'. "\ N" ;}?>
Database data dictionary
The above is the content of php and mysql _ query. For more information, see The PHP Chinese website (www.php1.cn )!