用PHP怎么取出MYSQL中的字段的comment内容

WBOY
Release: 2016-06-13 13:49:29
Original
1231 people have browsed it

用PHP如何取出MYSQL中的字段的comment内容
用PHP如何取出MYSQL中的字段的comment内容,如下面的语句建的表,如何使用PHP中的MYSQL函数取出每个字段的comment内容?

CREATE TABLE IF NOT EXISTS `zy_article` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`user_name` varchar(20) DEFAULT NULL COMMENT '用户名',
`article_type` int(11) DEFAULT NULL COMMENT '所属类别',
`article_title` varchar(255) DEFAULT NULL COMMENT '文章标题',
`article_content` text NOT NULL COMMENT '文章内容',
`post_date` datetime DEFAULT NULL COMMENT '发布时间',
`click_num` int(11) NOT NULL DEFAULT '0' COMMENT '点击次数',
`comment_num` int(11) NOT NULL DEFAULT '0' COMMENT '评论次数',
`article_tags` text COMMENT '文章标签',
`author` varchar(100) DEFAULT NULL COMMENT '作者',
`derivation` varchar(255) DEFAULT NULL COMMENT '出处',
`iscommend` char(1) NOT NULL DEFAULT '0' COMMENT '是否推荐',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=80 ;

------解决方案--------------------
使用Show命令
SHOW TABLE STATUS; or
mysqlshow --status TABLE;
------解决方案--------------------
错了,应该用
show full fields from '表名称'

------解决方案--------------------

PHP code
function show_fields($sql)
    {
        $result=mysql_query($sql);
        $data=array();
        while ($row=mysql_fetch_array($result))
        {
            $data[]=$row['Field'];
        }
        return $data;
    }
<br><font color="#e78608">------解决方案--------------------</font><br>调用:<br>print_r(show_fields('show full fields from zy_article')); <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template