mysql - PHP/SQL Check if a similar entry already exists in the database -
i have search on website , im trying show list of popular search terms on site sort of works isn't matching strings close enough.
this i'm using:
$sql = "select * db r_name '%".$searchname."%' or r_number '%".$searchname."%'
however if user searches game name
, searches game name (reviews)
add 2 entries database, there way similarity test before entering entry ?
yes, there way requires fiddle little. there search called soundex, match things close. might not perfect solution question, might started in right direction.
select * db soundex( db.r_name ) soundex( '{$searchname}' );
i believe if have entry 'lowercasexd' , , soundex like('what lowercasexd?'), find entry that's associated 'lowercasexd'. aware type of search take little while run compare '=' searches on indexed databases(on database 5-6k entries per second) not recommended big. if want near-perfect solution, suggest read google's search mechanism, , search engine source code if project significant enough.
Comments
Post a Comment