carlfaulkner Posted May 21, 2012 Share Posted May 21, 2012 Basically i want something like this SELECT * FROM table WHERE confirmed="1" and column1 like '%value%' or column2 like '%value' or column3 like '%value%' WHERE ....... I have a search bar and when clicking enter i want to search all rows where confirmed = 1 and any of the 3 other table columns are like the search string entered. Any ideas, but the above doesnt work. It does if i use just 2 or's Link to comment Share on other sites More sharing options...
justsomeguy Posted May 21, 2012 Share Posted May 21, 2012 Use parentheses to separate the OR and AND conditions. Link to comment Share on other sites More sharing options...
carlfaulkner Posted May 21, 2012 Author Share Posted May 21, 2012 I managed to get it working using WHERE Confirmed = '1' and CONCAT(title, description, city) like '%$searchstring%' Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now