php - MySQL: Help to search each word in multiple columns as case insensitive -


i have table contains: product, cost, comment.

id     product               cost     comment 1      tires rex              10      fast movement quality 2      bone maxx centri       110     clean , soft movement 3      engine damaged         20      damaged 

the outcome want: user can searches multiple words , query has find items words case insensitive.

for example, user searches: buy clean tires cars

the query output has show products id 1 , 2.

why?

  • because word clean matches comment in product id 2
  • because word tires matches product id 1

i tried with:

select * `inventory` match (product) against ('buy* clean* tires* for* cars*' in boolean mode); 

but works 1 column , case-sensitive.

i want searches in multiples columns case-insensitive.

any appreciated!

use following query, it's tested , returns first 2 rows:

select * `inventory` match (product, comment) against ('buy* clean* tires* for* cars*' in boolean mode); 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -