Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

Adjust search so it only finds rows with all words?

$
0
0

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!


Viewing all articles
Browse latest Browse all 13200

Latest Images

Trending Articles



Latest Images