帝国CMS教程:统计留言数量
很多时候我们时刻都想了解到自己的网站或者论坛的留言情况,在某个时间段里究竟有多少留言,数量又是多少。很有必要了解这些信息。
无忧主机小编就为大家介绍帝国CMS关于统计留言数量的方法,大体上分为指定模型与不指定模型两种情况下的统计留言方法。非常的实用哦。
具体实现方法如下:
1、指定模型:
留言数量代码如下:
<?php
$totalnum=(int)$_GET['totalnum'];
$totalquery="select count(*) as total from ***_enewsgbook where bid=1 and checked=0";
$num=$empire->gettotal($totalquery);//取得总条数
echo $num;
?>
2、不指定模型:
留言数量代码如下:
<?php
$totalnum=(int)$_GET['totalnum'];
$totalquery="select count(*) as total from ***_enewsgbook";
$num=$empire->gettotal($totalquery);//取得总条数
echo $num;
?>
简简单单的两段代码就可搞定。赶紧去尝试吧。
无忧主机相关文章推荐阅读: