Search code examples
phpmysqlspell-checking

How to spell check a brand that the customer input wrong and it exists in my database


I need some idea of how is the best way to spellcheck brands. I have a table in MYSQL with the name of my products and a form that leads to php search in brands table. But the some customer are input the name of products wrong and the search bring nothing in the results example:

The product is Heineken The customer put Heikenem , hekeinem , heken

Another case too is Jack Daniel's The customer input jack daniels, jack Danis


Solution

  • Sometimes we think only by one side, but if we really think in the roles of the subject, we can see another ways to reach the goal, in this case the goal is make the user avoid wrong inputs of specifics words in the search, for this case, the best way is use autocomplete because, you really don't want words that not exists in your database and the user really want result for things that you have in your database.