timvdalen Posted July 26, 2010 Share Posted July 26, 2010 Hi, I'm curious if someone ever wrote a script that did this. This would be cronstructing a query where a search is done for rows where a column has up to two or three other letters in it. I could write it myself, but it's only a small part of the project I'm working on, so if it doesn't already exist I'm just gonna ignore it. Tim Link to comment https://forums.phpfreaks.com/topic/208901-mysql-looks-like-script/ Share on other sites More sharing options...
Mchl Posted July 26, 2010 Share Posted July 26, 2010 Example? Link to comment https://forums.phpfreaks.com/topic/208901-mysql-looks-like-script/#findComment-1091193 Share on other sites More sharing options...
timvdalen Posted July 26, 2010 Author Share Posted July 26, 2010 Database with the following data: 1 John 2 Eliza 3 Tiffany User searches for 'Elisa', it should return the row with id 2. If the user imput is 'Tifany', row 3 should be returned. Some more examples: Jon, Jhon, Liza (although this is just a matter of LIKE %...%) Link to comment https://forums.phpfreaks.com/topic/208901-mysql-looks-like-script/#findComment-1091200 Share on other sites More sharing options...
Mchl Posted July 26, 2010 Share Posted July 26, 2010 For these examples SOUNDEX() could work well. http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#operator_sounds-like Link to comment https://forums.phpfreaks.com/topic/208901-mysql-looks-like-script/#findComment-1091201 Share on other sites More sharing options...
timvdalen Posted July 26, 2010 Author Share Posted July 26, 2010 For these examples SOUNDEX() could work well. http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#operator_sounds-like Interesting... Took me a while to get how it worked (I used the function on only one of the two values) but it works like a charm. Thank you. Link to comment https://forums.phpfreaks.com/topic/208901-mysql-looks-like-script/#findComment-1091221 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.