1

我在 cakephp 代码中遇到问题,以下代码工作正常。

 $options['conditions'] = array(
        'Tender.archidata_interest !=' => 'Not interesting',            
    );            
    $options['order'] = array(
        "FIELD(Status.flag, 'communication_pending', 'active')"
    );        
    $archidata_tender = $this->Tender->find('all', $options);

但蛋糕分页代码不适用于订单条款。

 $tender_cond[] = array('Tender.id' => $local_tenders_id);   
$this->paginate = array('page' => '1', 'limit' => $pagelimit, 'order' => array("FIELD(Status.flag, communication_pending, active)"));$this->set('tenders', $this->paginate('Tender', $tender_cond));

我正在使用 FIELD(Status.flag, communication_pending, active) 根据以下顺序获取结果,但它不起作用,也没有给出任何错误。需要帮助 谢谢

4

2 回答 2

0

只是您忘记了分页代码中的引号吗?尝试改变这个:

'order' => array("FIELD(Status.flag, communication_pending, active)")

对此:

'order' => array("FIELD(Status.flag, 'communication_pending', 'active')")
于 2012-11-23T14:51:08.733 回答
0

'order' => "FIELD(Status.flag, communication_pending, active)" 删除数组对我有用 :)

于 2014-05-05T05:47:01.813 回答