用php查询显示MYSQL字段注释

  echo "<table border=1 cellspacing=0 cellpadding=0 width=100% >\n";
  echo "<tr>\n";

  $query="select * from user";
  $result = mysql_query($query);
  for($i=0;$i<mysql_num_fields($result);$i++)
  {
       $temp=mysql_field_name($result,$i);
       $query_1="select column_comment from INFORMATION_SCHEMA.Columns where table_name='user' and table_schema='softinfo' and column_name like '$temp'";
       $result_1=mysql_query($query_1);
       $row_1=mysql_fetch_row($result_1);
        echo "<td nowrap>".$row_1[0]."</td>\n"; 
  }

  echo "</table>\n";

 

posted on 2013-06-04 17:35  一天一點  阅读(494)  评论(0编辑  收藏  举报