php - FULLTEXT not returning some searched words

976

I'm using fulltext in my search bar on my website. The code looks like this,

search.php

<form method="post" action="search.php">
<input type="text" name="search" />
<input type="submit" />
</form>
<?php
include("config.php");
$search = mysql_real_escape_string($_POST['search']);
echo $search;
$data = mysql_query("SELECT * FROM shop
    WHERE MATCH (name,description,keywords) AGAINST ('$search' IN BOOLEAN MODE);") or die(mysql_error());
while ($info = mysql_fetch_assoc($data)) {
    $name = stripslashes($info['name']);
    $desc = stripslashes($info['description']);
    Print "<h3><a href=\"result.php?product=".urlencode($name)."\">".$name."</a>: <font color=\"#cd0000\">".$desc."</font></h3><br>";
}
?>

And this works completely fine...for the most part. In my database, one of the rows under the description column reads: "1. Never run mysqld as root"

When I search "Never" or "Never run" into the search bar (without quotes obviously) This result does not show up. However, if I search "Never run mysqld" or just "mysqld" then this result shows up. Any idea why not all the words trigger the result?

People are also looking for solutions to the problem: security - COOKIE/PHP: Secure login for REAL

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.