How to check the value of multiple columns?

Good time of day.
There is a text input where user enters the address.
<input type="text" name="address" placeholder="Street, District, territory">

How to write the query so that the values in this field were searched for in several columns in the database table ?
Do this:
$query = "SELECT * FROM `objects` WHERE `bid_type`='$bid_type' AND `object_type`='$object_type' AND `address` LIKE '%$address%' AND `okrug` LIKE '%$address%'";

But constantly comes up false in the result.

How to write a query that value in input was sought in three-four columns and output all found results
April 3rd 20 at 18:33
3 answers
April 3rd 20 at 18:35
If the field bid_type and object_type not apply to address and okrug, like this:

SELECT * FROM `objects` 
 WHERE `bid_type`='$bid_type' 
 AND `object_type`='$object_type' 
 AND (`address` LIKE '%$address%' 
 OR `okrug` LIKE '%$address%')
thank you! - Anabelle_Kohler58 commented on April 3rd 20 at 18:38
April 3rd 20 at 18:37
All AND replace OR

And you will be "Happiness"
Then he gives me the objects,but does not account for these parameters
WHERE `bid_type`='$bid_type' AND `object_type`='$object_type'

and finds EVERYTHING in e input's address in independence from $bid_type and $object_type - Anabelle_Kohler58 commented on April 3rd 20 at 18:40
@Anabelle_Kohler58, then the answer below from another speaker . Parenthesis and one and ) - vidal.Legros commented on April 3rd 20 at 18:43
April 3rd 20 at 18:39
All newcomers to the polls think that the request applies to the entire database at once.
Well razmeetsya want to find rows where the street address And County equal to some value.

But if you think it compares request with the condition each row individually.
And will look for the linewhere in which the street address and County equal to this value.
While they need to return each row where the address OR district was equal to some value.

That is, instead of AND when you search "multiple columns" it is necessary to use OR.

Of course, this does not apply to other terms used in the query. They remain as they are, the search for "more fields" simply is taken in brackets.

Find more questions by tags PHPMySQLSQL