kickoutbettman Posted May 25, 2009 Share Posted May 25, 2009 Hello all, I created a little simple search engine and it works great for what I need. My only problem, is the data in MySql DB might contain some accents such has : é à è ê And some people will not put the accent and others will. Is there any way to let my search engine returns both results ? Thank you Quote Link to comment https://forums.phpfreaks.com/topic/159566-search-engine-with-accents/ Share on other sites More sharing options...
kickoutbettman Posted May 26, 2009 Author Share Posted May 26, 2009 Am I at the right place. Should this topic be posted in PHP forum ? ??? Quote Link to comment https://forums.phpfreaks.com/topic/159566-search-engine-with-accents/#findComment-842485 Share on other sites More sharing options...
gassaz Posted May 26, 2009 Share Posted May 26, 2009 Use LIKE... example: select * from base where name like 'something' If 'something' exist into the table with accent or with out accent, the select will show the records. Quote Link to comment https://forums.phpfreaks.com/topic/159566-search-engine-with-accents/#findComment-842679 Share on other sites More sharing options...
kickoutbettman Posted May 27, 2009 Author Share Posted May 27, 2009 You are right, it does work with MySql. It returns the good result. The problem is that I use PHP and a HTML form to grab the input from the user then assign it to $filter. $filter = $_GET['textfield']; SELECT * FROM city WHERE cityName LIKE '%$filter%' ***city example = Montréal *** So when I do that and type "Montreal" it returns nothing. But if I type "Montréal" it returns Montréal. The collation for my table = utf8_general_ci (so it should manage the accents correctly). Anybody knows whats happening ? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/159566-search-engine-with-accents/#findComment-843302 Share on other sites More sharing options...
fenway Posted June 2, 2009 Share Posted June 2, 2009 You should be able to CONVERT to an accent insensitive collation, like latin1. Quote Link to comment https://forums.phpfreaks.com/topic/159566-search-engine-with-accents/#findComment-847733 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.