联系我们

18176930112


建站、模板咨询

destoon产品总数,求购总数,供应总数的标注显示

destoon当前产品 总数 ,当前求购总数,当前供应总数的标注显示方法

第一步:在include/global.func.php建立table_counts函数
//$table 表明 例如:供应表sell 求购表buy 新闻表:article_21
//$where 条件 例如:status=3   最近一月发布的:status=3 and addtime>=".strtotime('-1 month')."
        function table_counts($table,$where){
        global $db,$DT_PRE;
        $count=$db->get_one("select count(*) as num from $DT_PRE$table where $where");
        return $count['num'];

第二步:根据参数调用总数的显示,以下代码是在模板页面添加的。
供应总数:{table_counts('sell','status=3')}
本月供应总数:{table_counts('sell',"status=3 and addtime>=".strtotime('-1 month')."")}

求购总数:{table_counts('buy','status=3')}
本月求购总数:{table_counts('buy',"status=3 and addtime>=".strtotime('-1 month')."")}

新闻总数:{table_counts('article_21','status=3')}
本月求购总数:{table_counts('article_21,"status=3 and addtime>=".strtotime('-1 month')."")}

要调用其他的表数据同理,只需要修改下参数即可。

电话

咨询电话:
4008857862
18176930112 13878897862

微信咨询

千人QQ交流群

购物车

客服

顶部