Match Human input string to database field

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
btm
Forum Newbie
Posts: 11
Joined: Wed Sep 14, 2005 7:21 am

Match Human input string to database field

Post by btm »

Hi,
Basically, I have a field in a table that a person inputs a name of who they want their roommate to be. The roommate will already be in the table, the the name typed in might not exactly match the 'name' field in the table. My task is to generate a list of possible matches. I'm at a bit of a loss of how to accomplish this. I was thinking that I could do the first query, take the rommate field and remove all vowels, then query the table again and step through each 'name' field, remove the vowels, and see if they match, then print all matches. If anyone has any cleaner ideas than this, I'd love to hear them...
Thanks!
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Have a look at the soundex() function and levenshtein(), metaphone(), and similar_text().
Post Reply