我需要使用DESC订单日期来过滤寻呼机,我已经尝试了但仍然不适合我,任何想法的朋友?
public function admin_index(){
$this->layout = "admin_default";
$conditions = array('status'=>1);
$filter = array();
if(!empty($this->request->query)){
$search = basicsLix::removeAcutes('%'.$this->request['url']['search'].'%');
$filter = $this->request->query;
$conditions += array('OR' => array(
basicsLix::removeSpecialCharacter('purchaser_name')=>$search),
'order'=>array( 'payment_date' => 'asc'));
}
$purchases = $this->paginate('Purchase', $conditions);
$this->set(compact('purchases', 'filter'));
}
错误:
Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order = ('asc') LIMIT 20' at line 1
SQL查询:SELECT Purchase
。id
,Purchase
。track_id
,Purchase
。purchase_order
,Purchase
。{ {1}},purchaser_name
。Purchase
,purchaser_email
。Purchase
,amount
。Purchase
,status
。{{1 },Purchase
。dispatched
,Purchase
。method
,Purchase
。payment_date
,Purchase
。hash
,Purchase
。created
FROM Purchase
。modified
AS resultados_tagid
WHERE purchases
= 1 AND CONVERT(CAST(UPPER)(TRAR(REPLACE) (REPLACE(buyerser,',',''),'。',''),' - ','')))二进制)使用utf8)LIKE' %%' AND order =(' asc')LIMIT 20
答案 0 :(得分:0)
试试这个 -
if(!empty($this->request->query)){
$search = basicsLix::removeAcutes('%'.$this->request['url']['search'].'%');
$filter = $this->request->query;
$conditions += array('OR' => array(
basicsLix::removeSpecialCharacter('purchaser_name')=>$search)),
$conditions['order']=array( 'payment_date' => 'asc');
}