The following query:
Code: Select all
SELECT *, MATCH(url,title,description) AGAINST ('free design and templates') as Relevance FROM links WHERE MATCH (url,title,description) AGAINST('free design and templates' IN BOOLEAN MODE) ORDER BY Relevance DESCPHP code:Can't find FULLTEXT index matching the column list
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/pgolovko/public_html/adp/search1.php on line 24
Code: Select all
$searchwords = addslashes(htmlspecialchars($_POST['swords']));
if (strlen($searchwords) < 3){
echo "The word you have inputted is too short, please enter another one.";
}
else{
$sql = "SELECT *, MATCH(url,title,description) AGAINST ('$searchwords') as Relevance FROM links WHERE MATCH (url,title,description) AGAINST('$searchwords' IN BOOLEAN MODE) ORDER BY Relevance DESC";
$result = mysql_query($sql);
echo mysql_error();
if (mysql_num_rows($result) <> ''){
while ($row = mysql_fetch_array($result)) {
$url = $row['url'];
$title = $row['title'];
$description = " - ".$row['description'];
print "<li><a href=\"$url\">$title</a>$description";
}
}
}