I have this query where I can search the TABLE_GLOBAL_PRODUCTS
$catglobal_sql = "
select p.*,
case when
p.specials_new_products_price >= 0.0000
and p.expires_date > Now()
and p.status != 0
then p.specials_new_products_price
else p.products_price
end price
from ".TABLE_GLOBAL_PRODUCTS." p
INNER JOIN ".TABLE_STORES." s ON s.blog_id = p.blog_id
where
MATCH (p.products_name,p.products_description) AGAINST ('%".$search_key."%')
OR p.products_name like '%".$search_key."%'
order by p.products_date_added DESC, p.products_name";
The issue here is that, when I search with phrases like Cotton Shirts it displays correct results. However, when I only input a single word like Cotton it displays no results instead of displaying the same as when you input a phrase like Cotton Shirts.
Use * instead of % as a wildcard when using MATCH … AGAINST …
So the match part of your code should look like:
In MATCH the wildcards are slightly different
To match zero or more characters use
To match any single character use