0

I am using Codeigniter framework. I have a database table 'product', it has a column 'title' and the title is 'Canon Digital SLR Camera'.

I want to search my table with the text 'cannon' (double n) and it should return 'Canon Digital SLR Camera'.

Currently I am using

SELECT * FROM product WHERE title SOUNDS LIKE 'Cannon Dgtal SLR Cemera'";

and it is working fine. But I don't want to write long title, I just want to write 'cannon' (misspelled word) and it should return full product title.

How can I achieve this? Any help would be really appreciated.

  • https://stackoverflow.com/questions/634995/implementation-of-levenshtein-distance-for-mysql-fuzzy-search – failedCoder Feb 20 '20 at 15:23
  • try with soundex function https://www.w3resource.com/mysql/string-functions/mysql-soundex-function.php – Alberto Sinigaglia Feb 20 '20 at 15:24
  • @Berto99 `SOUNDS LIKE` is [the same as `SOUNDEX()`](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#operator_sounds-like) – Cid Feb 20 '20 at 15:25

0 Answers0