rondog Posted March 5, 2008 Share Posted March 5, 2008 The search doesn't work on the forum right now and I'm sure this has been brought up many times. so I guess this will work for multiple words. <?php $arr = explode(' ', $searchtxt); $query = "SELECT * FROM video WHERE keywords LIKE '%$searchtxt%'"; foreach($arr as $v) { $query .= " OR keywords LIKE '%$v%'"; } $result= mysql_query($query); $totalRows = mysql_num_rows($result); ?> Ok lets use the word "Africa" as an example. If I search "africa" something with africa in the keywords field pops up...if I search "african" nothing comes up. How can I make it so whether I search for "africa" or "african" they both will pop up the results? Link to comment https://forums.phpfreaks.com/topic/94531-help-with-search-query/ Share on other sites More sharing options...
revraz Posted March 5, 2008 Share Posted March 5, 2008 Doesn't that mean anything with "a", "can", "ric", "af" etc would also show up? It makes sense that "Africa" would return "Africa" and "African" and not vice versa. I'm sure there are more searches than just this one word you will be doing right? Link to comment https://forums.phpfreaks.com/topic/94531-help-with-search-query/#findComment-484046 Share on other sites More sharing options...
rondog Posted March 5, 2008 Author Share Posted March 5, 2008 no thats exploding at the ' '(space)..basically for multiple words.. so lets say I didnt have that...and I searched "africa lion" It would look specifically for that rather than "africa" and "lion" Link to comment https://forums.phpfreaks.com/topic/94531-help-with-search-query/#findComment-484052 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.