mysql_query("select * from links where SiteURL like '%$term%' or Description like '%$term%' or SiteName like '%$term%' or SiteURL like '%$term2%' or Description like '%$term2%' or SiteName like '%$term2%' limit 0,$maximum",$db);
this is a simple search function with some keywords. hope u understand.
check this then http://mysql.com/doc/C/o/Comparison_Operators.html
select keyword1 != keyword2 from tablename;
cheers
klyan
Shaw-Han wrote:
Hi,
i am building a catalog site.. each catalog item is identified by a bunch of keywords (i.e. red, plastic, discount) etc.
right now these keywords are being stored in individual table columns (i.e. keyword1, keyword2, keyword3..) for each item. there isn't a lot of overlap or repeated keywords so i thought this would be best.
it is relatively painless to search for any single keyword this way.
my question is, how can i build a mySQL search query which can perform logical AND/OR/NOT or on all of the keyword columns at the same time?
eg: find all items with keywords RED and PLASTIC but not DISCOUNT?
any help would be appreciated.
thanks,
shaw-han