I have a search form and I would like to select similar items from database based on the searched title.
Now I use SELECT * FROM movies WHERE title LIKE '%".$_SESSION['search']."%';
But e.g. someone search for 'Jurassic Park2' or 'Jurasic Park 2' it doesn't give 'Jurassic Park 2'.
How can I select those movies which has some character difference against the searced title?
You're looking for Mysql full text search. Here's a tutorial to get started.
Basically you need to create a fulltext index on the field(s) you want to search, then you can use a query to look up similar values:
MATCH (col1,col2,...) AGAINST (expr [search_modifier])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With