My MySQL database table contains 2510 records. When I try to search for a string in a column, using fulltext search, sometimes, I don't get any results. Just an empty html table.
For example, I'm searching for the author 'Peter Schmidt'. If I search for 'Peter' I'll get the right author, but if I search for 'Schmidt', the html table shows other authors, but not the right one. The author's column consist of 'surname, name' (Schmidt, Peter).
This is a piece of my code:
$author = mysql_real_escape_string($_GET['author']);
$sql = "SELECT * FROM books WHERE MATCH(author) AGAINST ('$author' IN BOOLEAN MODE)";
$query = mysql_query($sql);
if (!$query) {
echo 'We cannot find the author you are searching for. Please try again.';
echo '<a href="'.$_SERVER['PHP_SELF'].'" class="back" style="margin:0;" title="Go back">» Go back</a>';
} else {
echo '<p>These authors match your query:</p><table>'
while ($result = mysql_fetch_array($query)) {
echo '<tr><td>'.$result['author'].'</td></tr>';
}
echo '</table>'
}
What causes this issue?