Home  >  Article  >  Backend Development  >  php 查询语句select count(*) from 表 where type='文艺生活'如何输出结果

php 查询语句select count(*) from 表 where type='文艺生活'如何输出结果

WBOY
WBOYOriginal
2016-06-13 12:58:262387browse

php 查询语句select count(*) from 表 where type='文艺生活';怎么输出结果
       $sql="select count(*) from 表 where type='文艺生活'";
    $result=mysql_query($sql);
while($row=mysql_fetch_array($result)){
?>
    

 ?? 
        }
   ?>
不知道这块该怎么写输出结果,该怎么写
------解决方案--------------------
<br />
    $sql="select count(*) as `cnt` from 表 where type='文艺生活'";<br />
    $result=mysql_query($sql);<br />
if($row=mysql_fetch_array($result)){<br />
?><br />
    <td height="25" align="center" valign="middle"> <?php echo $row['cnt']?> </td><br />
   <?php<br />
    }<br />

------解决方案--------------------
把 count(*) 改成 *
------解决方案--------------------
或者这样:
  
------解决方案--------------------
Statement:
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