How to Connect Multiple Nots with CakePHP

Asked 2 years ago, Updated 2 years ago, 51 views

Model.col1 does not contain throw

And

Model.col2 does not contain

Please tell me how to write conditions when retrieving .

|col1|col2|Retrieve|
|---|---|---|
|Blow | No |
|Dark |No |
|Dark | No |
|Dark|Dark|Dark|

php cakephp

2022-09-30 19:57

1 Answers

Write the NOT directly in the column name of the condition.
The following is an example of using the model Model on the SamplesController.

$this->loadModel('Model');
$params=array
(
    'conditions' = > array
    (
        'col1NOT' = > 'Hage',
        'col2NOT' = > 'Fluff',
    )
);

$return=$this->Model->find('all',$params);


2022-09-30 19:57

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.