Jump to content

Help with search query


rondog

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.