Jump to content

Recommended Posts

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 by liamdawe
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.