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

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

WBOY
Release: 2016-06-13 12:58:26
Original
2418 people have browsed it

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 />
Copy after login

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