gurechan Posted August 9, 2006 Share Posted August 9, 2006 Hi, I'm trying to set up a search form and using the LIKE command in MySQL, ie:SELECT * FROM books WHERE title LIKE '%$search%'Now say I have a heap of books that have the work [b]book [/b]in the title, this query works fine if you enter book in the search field, but if you enter [b]books [/b]you get no results.Is there an easy way to get it to still find a match. Quote Link to comment https://forums.phpfreaks.com/topic/17008-like-command/ Share on other sites More sharing options...
AndyB Posted August 9, 2006 Share Posted August 9, 2006 http://mysql.com/doc/refman/5.0/en/pattern-matching.htmlSELECT * FROM books WHERE title LIKE '$search%' Quote Link to comment https://forums.phpfreaks.com/topic/17008-like-command/#findComment-71799 Share on other sites More sharing options...
gurechan Posted August 9, 2006 Author Share Posted August 9, 2006 Yeah, I've seen and tried that. Still has the same result tho. Quote Link to comment https://forums.phpfreaks.com/topic/17008-like-command/#findComment-71808 Share on other sites More sharing options...
fenway Posted August 9, 2006 Share Posted August 9, 2006 Nope -- there's no easy way; you can hack and remove the trailing "s" and try the query again, but it's kludgy at best. Quote Link to comment https://forums.phpfreaks.com/topic/17008-like-command/#findComment-71818 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.