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? Quote Link to comment 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? Quote Link to comment 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" Quote Link to comment 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.