Trez
Trez

Reputation: 1182

How to search a 'near word' in MySQL?

For example, I want to search a word 'marple', this should return row with near or exact word like 'marble','maple','marple', etc...

How to do it in mysql query? or better give word suggestion if any?

Upvotes: 6

Views: 2614

Answers (3)

Kanak Vaghela
Kanak Vaghela

Reputation: 8358

You can use this

$sql = "select * from tbl_name where your_field like '%your search keyword%'";

Upvotes: 0

Egor Pavlikhin
Egor Pavlikhin

Reputation: 17981

SOUNDEX function.

"Two strings that sound almost the same should have identical soundex strings."

Upvotes: 5

Piotr Gwiazda
Piotr Gwiazda

Reputation: 12212

In MySQL you can try use soundex function, but it's not a real solution. Use Sphinx or Lucene.

Upvotes: 2

Related Questions