macmonkey
01-11-2006, 01:54 AM
Greetings,
I've got a simple search form whereas users can search products on my site. On the dbase end I've got a column called product_keywords and it has terms separated with a comma:
ie: brown, necklace, handbag, trendy...
and when I search for brown necklace I get no results but if I search for necklace brown I get acceptable results.
Here's my query
$sql="SELECT * FROM products WHERE product_showonfrontend='Y' AND (INSTR(LCASE(product_source_code),'".$search_text."') != 0 OR INSTR(LCASE(product_name),'".$search_text."') != 0 OR INSTR(LCASE(product_general_category),'".$search_text."') != 0 OR INSTR(LCASE(product_description),'".$search_text."') != 0 OR INSTR(LCASE(product_keywords),'".$search_text."') )";
any ideas?
I've got a simple search form whereas users can search products on my site. On the dbase end I've got a column called product_keywords and it has terms separated with a comma:
ie: brown, necklace, handbag, trendy...
and when I search for brown necklace I get no results but if I search for necklace brown I get acceptable results.
Here's my query
$sql="SELECT * FROM products WHERE product_showonfrontend='Y' AND (INSTR(LCASE(product_source_code),'".$search_text."') != 0 OR INSTR(LCASE(product_name),'".$search_text."') != 0 OR INSTR(LCASE(product_general_category),'".$search_text."') != 0 OR INSTR(LCASE(product_description),'".$search_text."') != 0 OR INSTR(LCASE(product_keywords),'".$search_text."') )";
any ideas?