jjacquay712 Posted October 3, 2008 Share Posted October 3, 2008 I have a php script that generates search querys. The generated query looks like this when i enter the search term "test", and "search": SELECT title,description,link FROM search WHERE title like '%test%' or description like '%test%' or link like '%test%' and title like '%search%' or description like '%search%' or link like '%search%' My problem is that it always returns a result even if the second AND statement is evaluated false. I have talked to a few people about this and they said my "order of operations" are wrong in the query. Can someone explain how i could do the query different to get the desired results? Link to comment https://forums.phpfreaks.com/topic/126939-solved-sql-order-of-operations-in-and-and-or-operators/ Share on other sites More sharing options...
AndyB Posted October 4, 2008 Share Posted October 4, 2008 Asked and answered http://www.phpfreaks.com/forums/index.php/topic,219441.msg1005766.html#msg1005766 Please DO NOT double post. Thread closed. Link to comment https://forums.phpfreaks.com/topic/126939-solved-sql-order-of-operations-in-and-and-or-operators/#findComment-656736 Share on other sites More sharing options...
Recommended Posts