TP框架中多条件筛选

        $pid =I('pid');

        $year = I('year');

        $productType = I('productType');

        //搜索条件 where

        $_where = "cinfo.uid=$uid and cg.type=1 and cg.status=1";

        if($pid){

            $_where .= " and c.pid=$pid";

        }

        if($year){

            $_where .= " and c.year=$year";

        }

        if($productType){

            $_where .= " and c.productType=$productType";

        }

posted @ 2017-10-09 10:05  刘俊涛的博客  阅读(1072)  评论(0编辑  收藏  举报