3
回答
mysql处理列表排序问题:过期信息排在后面
注册华为云得mate10,2.9折抢先购!>>>   

数据表有个关于过期时间的字段: guoqi

下面的两段代码,是把过期的信息过滤掉,请问怎样,怎么样让过期信息排在没过期信息后面呢,不过滤。

if($this->TotalResult==-1)
        {
            //日期过滤
        if ($this->TypeLink->TypeInfos['channeltype']==1) {
        $nowtime = time()-43200;
    $timesql = " AND {$addtable}.guoqi > $nowtime ";
    $cquery = "SELECT COUNT(*) AS dd FROM `#@__arctiny` arc $addJoin WHERE ".$this->addSql.$timesql;
    }
    else{
    $cquery = "SELECT COUNT(*) AS dd FROM `#@__arctiny` arc $addJoin WHERE ".$this->addSql;
    }

 //文档模型过期文档过滤
        if ($this->TypeLink->TypeInfos['channeltype']==1) {
        $nowtime = time()-43200;
    $timesql = " AND {$addtable}.guoqi > $nowtime ";
    $query = "SELECT arc.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,
          tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath
          $addField
          FROM `#@__archives` arc
          LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id
          $addJoin
          WHERE {$this->addSql} $timesql $ordersql LIMIT $limitstart,$row";
    }

举报
你说的呢
发帖于2年前 3回/123阅
顶部