# Query builder: select with multiple OR-conditions

**URL:** <https://discourse.cakephp.org/t/query-builder-select-with-multiple-or-conditions/4958>\
**Category:** Need Help\
**Created:** [September 19, 2018, 10:20pm UTC](https://discourse.cakephp.org/t/query-builder-select-with-multiple-or-conditions/4958 "2018-09-19T22:20:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dolando](https://avatars.discourse-cdn.com/v4/letter/d/dc4da7/32.png) [@Dolando](https://discourse.cakephp.org/u/Dolando)\
**Post date:** [September 19, 2018, 10:20pm UTC](https://discourse.cakephp.org/t/query-builder-select-with-multiple-or-conditions/4958/1 "2018-09-19T22:20:42Z")

</div>

I would like to have a select statement with more than two OR-statements.  
My code looks like this:

$fl = TableRegistry::get(‘Ferns’);  
$query = $fl-\>find();

$query = $query-\>where ([‘OR’ =\>  
[‘LOWER(familie\_wissenschaftlich)’ =\> $eingabe],  
[‘LOWER(familie\_de)’ =\> $eingabe],  
[‘LOWER(familie\_fr)’ =\> $eingabe],  
]);  
$result = $query  
-\>find(‘all’)  
-\>toArray();

Unfortunately it does not work. When I click on the CakePHP-Debug-Kit-Button and look at the Sql-Log the WHERE-Statements looks like that:

WHERE  
(  
LOWER(familie\_wissenschaftlich) = ‘aspleniaceae’  
AND LOWER(familie\_de) = ‘aspleniaceae’  
AND LOWER(familie\_fr) = ‘aspleniaceae’  
)

Could somebody please help me? Why is there and AND in the Where-clause and not a OR?  
I am working with CakePHP 3.5.2.  
Thank you for any helpfull advice.

Dorothee

---

<div class="post-metadata">

**Author:** ![Salines](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/salines/32/3166_2.png) [@Salines](https://discourse.cakephp.org/u/Salines)\
**Post date:** [September 21, 2018, 11:20am UTC](https://discourse.cakephp.org/t/query-builder-select-with-multiple-or-conditions/4958/2 "2018-09-21T11:20:55Z")

</div>

> [@Dolando](#):
>
> $query = $query-\>where ([  
> ‘OR’ =\>  
> [ \<------ ADD  
> [‘LOWER(familie\_wissenschaftlich)’ =\> $eingabe],  
> [‘LOWER(familie\_de)’ =\> $eingabe],  
> [‘LOWER(familie\_fr)’ =\> $eingabe],  
> ] \<-------ADD  
> ]);

[https://book.cakephp.org/3.0/en/orm/query-builder.html#advanced-conditions](https://book.cakephp.org/3.0/en/orm/query-builder.html#advanced-conditions)
