It is necessary to make a request that looks for possible matches, but it’s necessary that he urgently takes into account 2 conditions.

SELECT * FROM objects WHERE ID='$id1' or tower='$tower1' or reg='$adress1' or floor='$floor1' or area='$area1' or undonds='$undonds1' or price='$price1' and rentorsale='1'and salebis='1' 

In this example, rentorsale and salebis should be counted first, and then, if they are the same, others should be counted. Now the problem is that only rentorsale is taken into account, and the salebis is ignored.

  • write to him explicitly (rentorsale = '1' and salebis = '1') and (a or b) - splash58
  • The rentorsale and salebis should be counted first. There are no queues in the request. The condition is either checked or not. If the condition is checked but not fulfilled, the recording is not output, otherwise it is output. Everything. - Akina

2 answers 2

 SELECT * FROM objects WHERE (ID ='$id1' ) + (tower ='$tower1' ) + (reg ='$adress1' ) + (floor ='$floor1' ) + (area ='$area1' ) + (undonds ='$undonds1') + (price ='$price1' ) + (rentorsale='1' ) + (salebis ='1' ) >= 2 
     SELECT * FROM ( select * from objects where rentorsale = '2' and salebis = '1' and activity = '1' ) AS results where ID = '$id1' or tower = '$tower1' or reg = '$adress1' or floor = '$floor1' or area = '$area1' or undonds = '$undonds1' or price = '$price1'