6

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?

Brian Tompsett - 汤莱恩
  • 5,438
  • 68
  • 55
  • 126
Trez
  • 1,042
  • 5
  • 15
  • 23

3 Answers3

5

SOUNDEX function.

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

Egor Pavlikhin
  • 16,823
  • 15
  • 59
  • 98
2

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

Piotr Gwiazda
  • 11,986
  • 12
  • 56
  • 89
0

You can use this

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

Kanak Vaghela
  • 6,900
  • 10
  • 31
  • 36