View Full Version : PHP / MySQL Search Problem

01-11-2006, 02:54 AM

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?

01-11-2006, 03:51 PM
you should really look at Full-Text Searching (http://dev.mysql.com/doc/refman/4.1/en/fulltext-search.html)

01-11-2006, 04:10 PM
I know about FULLTEXT and wish that I could just use that BUT... the table type isn't MYISAM so that wont work for me.

If it was a personal site I'd change it but it's for a client :(