I'm writing a search engine to query a database to my site. I know how to use a WHERE product_name = "foo" if somebody enters the exact product name, but how could I do something like: WHERE product_name = "*foo*" so all results containing "foo" in product name would be returned and not just products named only "foo"?
Thanks in Advance,
Dan Anderson
Sounds like you want to use LIKE or REGEXP, which are described here:
http://www.mysql.com/doc/en/String_comparison_functions.html
Either of these expressions should do it:
WHERE product_name LIKE '%foo%'
or
WHERE product_name REGEXP 'foo'
-- Paul DuBois, Senior Technical Writer Madison, Wisconsin, USA MySQL AB, www.mysql.com
Are you MySQL certified? http://www.mysql.com/certification/
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]