Lagreca Posted June 15, 2009 Share Posted June 15, 2009 I have this problem with Dropular's (http://dropular.net/) search result. This the query I use to receive the DB result when someone for example searches for "red" : $get_results = "SELECT * FROM articles WHERE img LIKE '%".$search_string."%' OR title LIKE '%".$search_string."%' OR pool LIKE '%".$search_string."%' ORDER by date DESC LIMIT ".$num.",50"; This works just fine, BUT i want the result only to display this where example TYPE = "image" So, basically, take the result of $get_results, filter it down and look for where TYPE = "image" and keep only these, and remove the others (e.g where TYPE = video or TYPE = link). I hope you understand my question.. very hard to explain. 've tried is: $get_results = "SELECT * FROM articles WHERE img LIKE '%".$search_string."%' OR title LIKE '%".$search_string."%' OR pool LIKE '%".$search_string."%' AND type = 'image' ORDER by date DESC LIMIT ".$num.",50"; But that does not work.. doesnt seem like multiple LIKE and WHERE works together well.. :'( Best, Lagreca Quote Link to comment https://forums.phpfreaks.com/topic/162209-help-please/ Share on other sites More sharing options...
Zane Posted June 15, 2009 Share Posted June 15, 2009 $get_results = " SELECT * FROM articles WHERE ( img LIKE '%".$search_string."%' OR title LIKE '%".$search_string."%' OR pool LIKE '%".$search_string."%' ) AND type = 'image' ORDER by date DESC LIMIT ".$num.",50"; Did you try parentheses Quote Link to comment https://forums.phpfreaks.com/topic/162209-help-please/#findComment-856056 Share on other sites More sharing options...
Lagreca Posted June 15, 2009 Author Share Posted June 15, 2009 thanks man... Quote Link to comment https://forums.phpfreaks.com/topic/162209-help-please/#findComment-856057 Share on other sites More sharing options...
Zane Posted June 15, 2009 Share Posted June 15, 2009 no problem. glad to help. now if your question is completely solved...could you please click the Topic Solved button and the lower left corner of the screen. (above Quick Reply) Quote Link to comment https://forums.phpfreaks.com/topic/162209-help-please/#findComment-856059 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.