Phpmysqlquery-PHP source code

Source: Internet
Author: User
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. ='
    '. "\ N"; $ html. ='
    '. "\ N"; $ html. ='
    '. "\ N"; $ html. ='
    '. "\ N"; $ html. ='
    '. "\ N"; $ html. ='
    '. "\ 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. ='
    '. "\ N"; $ html. ='
    '. "\ N"; $ html. ='
    '. "\ N"; $ html. ='
    '. "\ N"; $ html. ='
    '. "\ N"; $ html. ='
    '. "\ N"; $ html. ='
   '. "\ N" ;}}$ html. ='
  '. "\ N"; $ html. ='
 
Field nameData typeDefault valueAllow non-emptyAuto incrementRemarks
'. $ F ['column _ name'].''. $ F ['column _ type'].''. $ F ['column _ default'].''. $ F ['is _ nulllable'].''. ($ F ['Extra'] = 'auto _ secret '? 'Yes ':'').''. $ F ['column _ comment'].'
'. "\ 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 )!

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.