Diego
Diego

Reputation: 591

How to search for random string matches in MYSQLi?

I'm working in a voice recognition algorithm that looks for matches at a DataBase(MySQLi). My problem is that if I recognize something like: Milk Shake, and I have Milkshake at my DB (without white space) then I wont have a Math by using LIKE.

WHERE products.status = 1 AND products.product_name LIKE "%'.$key.'%"

Is there a way to get a match with Milk Shake and Milkshake at my Database? *delete all white spaces is not an option.

Upvotes: 3

Views: 47

Answers (1)

Mphiwe Ntuli
Mphiwe Ntuli

Reputation: 32

It looks like the following statement achieves what you are tying to do.

WHERE products.status = 1 AND products.product_name LIKE '%Milk%Shake%';

Upvotes: 2

Related Questions