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 */
}
}
}
}

Link to comment
Share on other sites

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

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.