现在入驻立享优惠!详情咨询客服>> QQ:115904045 QQ群:160457583 VIP群:540574329

您当前的位置:首页>>CSS教程>>destoon教程

【腾讯云】爆款1核2G云服务器首年48元,还有iPad Pro、Bose耳机、京东卡等你来抽! 爆款云产品,新客特惠全年最低价,云服务器低至0.4折起

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

来源:超级管理员 发布时间:2021-11-23 热度:873 ℃

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')."")}

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

发表评论:

评论记录:

未查询到任何数据!