Jump to content

My product search... Need some help please =p


vicodin

Recommended Posts

Ok so this is what i need to do. I havent even tested this code yet but i think it will work. This is what i want to do. It takes the search information and breaks it down into an array by white spaces. It then takes each word and searches the key words section in my database. So what i need to do is if it finds a result output the product, stop looking at the product and go to the next if it finds a result in the keywords... not sure exactly how i would do that... any ideaS?

 

function SearchIt($search){
if (!empty($search)){
$search = CheckData($search);	
$search = explode(" ",$search); 
mysql_select_db("*******") or die(mysql_error());
foreach($search as $words){
$query =("SELECT * FROM products WHERE MATCH(keywords) AGAINST('$word') ORDER BY score DESC");
while ($row = mysql_fetch_array($result)){
/*Echo the product */
}
}
}
}

Ok so lets say they search for ARS8000 Optical Machine.

 

and i have ARS8000 Optical in my database under my keywords.

its gonna produce two of the same results because its gonna hit on ARS8000 and Optical.

I want it when it finds a matching result stop looking at it produce the output and go on to the next entry

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.