CakePHP发现WHERE NOT EQUAL

前端之家收集整理的这篇文章主要介绍了CakePHP发现WHERE NOT EQUAL前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
你能看到错误的家伙吗?我的AND条件被忽略了!我对这些阵列感到非常沮丧..
$transaction_query = $this->Transaction->find('all',[
                    'limit' => $countList,'fields' => ['Transaction.client_id','Transaction.name','Transaction.created','Transaction.message_id','Transaction.credit'],'conditions' => ['Transaction.id' => $client_id],'AND' => ['Transaction.name !=' => 'Facturation']
                ]);
您的条件必须是[‘Transaction.id’=> $client_id,’Transaction.name!=’=> ‘Facturation’].条件数组的多个条件被解释为“AND”条件.

所以你的查询看起来像: –

$transaction_query = $this->Transaction->find('all',[
        'limit' => $countList,'fields' => [
            'Transaction.client_id','Transaction.credit'
        ],'conditions' => [
            'Transaction.id' => $client_id,'Transaction.name !=' => 'Facturation'
        ]
    ]
);

您只需索引,如果您有重复的条件数组键;在您的示例中不是这种情况,因为您有Transaction.id和Transaction.name!=.无论如何,和索引需要是条件数组中的索引,而不是兄弟.

原文链接:https://www.f2er.com/php/135019.html

猜你在找的PHP相关文章