liamdawe Posted December 18, 2013 Share Posted December 18, 2013 (edited) Hi all, I am currently trying to upgrade my websites search function, currently it will just list every article it finds with any of the words searched using PDO MySQL like so: $db->sqlquery("SELECT a.article_id, a.`title` , a.author_id, a.`date` , a.guest_username, u.username FROM `articles` a LEFT JOIN `users` u ON a.author_id = u.user_id WHERE a.active =1 AND MATCH ( a.`title` ) AGAINST ( ? IN BOOLEAN MODE ) ORDER BY a.date DESC LIMIT 0 , 30", array($search_text)); $found_search = $db->fetch_all_rows(); What I want to do is have a second option, where it searches for rows that have all of the words in it not just any of the words. $search_text contains the list of words separated by a space. Is this possible? Thanks! Edited December 18, 2013 by liamdawe Quote Link to comment https://forums.phpfreaks.com/topic/284833-adjust-search-so-it-only-finds-rows-with-all-words/ Share on other sites More sharing options...
Barand Posted December 18, 2013 Share Posted December 18, 2013 ... AGAINST ( '+apple +iPad') must contain both apple and iPad Quote Link to comment https://forums.phpfreaks.com/topic/284833-adjust-search-so-it-only-finds-rows-with-all-words/#findComment-1462632 Share on other sites More sharing options...
liamdawe Posted December 18, 2013 Author Share Posted December 18, 2013 Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/284833-adjust-search-so-it-only-finds-rows-with-all-words/#findComment-1462643 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.