I am trying to search two columns of a database using this little pdo statement:
$search = $pdo->prepare("
SELECT * FROM books WHERE MATCH (title, author) AGAINST (? IN BOOLEAN MODE);
");
$search->execute(array('*' . $_POST['search'] . '*'));
Let's say our string is:
Harry Potter and the Philosopher's Stone by J.K Rowling
(I have this book title and author stored in a db which is using MyISAM as storage engine)
If I search for let's say Har(the first part of Harry keyword) I am able to return the result that I'm looking for but if I type rry(the last part of Harry keyword) I can't get the result that I'm looking for.
And also is there a way to display my desired result if the keyword is misspelled like Harru instead of Harry(using as little php as possible)?
Thank you for your time! :D