Jump to content

key word search


kevbev16

Recommended Posts

I bought this auction script and the search engine does not work properly. at the moment it is searching for exact phrases/words they continue on from each other so if you look on my website at http://www.bid4tackle.com/detail.php?item_id=752 it is called "Fox Evolution 3 Rod Holdall " at the moment you would have to search for the exact continuous words so "fox Evolution 3 Rod Holdall" or "fox evolution 3 rod" or "fox evolution" i.e. any keywords which follow each other e.g. "3 rod holdall". i want it to search for keywords so it would appear if you searched for "fox", "evolution" ... or key words which are not continuous so "fox" + "rod holdall" or "evolution" +"Holdall"etc.

 

i am only 18 and know very little about php if you could help i would be much appreciative.

 

if($mode=="keysearch")

{

if(!empty($key_word))

{

$key_word=trim($key_word);

$sql="select * from user_registration where user_name='$key_word' ";

$table=mysql_query($sql);

if($row=mysql_fetch_array($table))

{

$user_id = $row['user_id'];

}

$sql="select * from placing_item_bid  where status=\"Active\" and selling_method!=\"want_it_now\" and selling_method!=\"ads\" and  (item_title like \"%$key_word%\" or detailed_descrip like \"%$key_word%\" or  item_id=\"$key_word\" or user_id=\"$user_id\") and bid_starting_date <= now() and ";

}

else

{

$sql="select * from placing_item_bid where status=\"Active\" and selling_method!=\"want_it_now\" and selling_method!=\"ads\" and bid_starting_date <= now() and expire_date>=now()";

}

if(!empty($show))

{

if($show=="all")

$sql.=" ( selling_method= \"auction\" or selling_method= \"dutch_auction\" or selling_method= \"fix\" ) ";

else if($show=="bid")

$sql.=" ( selling_method= \"auction\" or selling_method= \"dutch_auction\") ";

else if($show=="buy")

$sql.=" selling_method=\"fix\" ";

}

$sql=rtrim($sql," and ");

$save_sql=$sql;

 

$save_sql=$sql;

 

}

 

 

some one has already told me that the person who coded this is a bit mad. someone esle said try :

$sql="select * from user_registration where user_name LIKE '%".$key_word."%' ";

 

but that did not work. i have attached the other relevant files

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/138239-key-word-search/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.