0

im having issue with a php script that retrieves values from a database and see's which ones match an input term. I either get the resourceID #4 error or no response.

Im basically trying to retrieve similar entries and of those similar entries show the name and date of their submission

$input = mysql_real_escape_string($_POST["interest"]);
$query1 = "SELECT name,interest_desc,date, MATCH(interest_desc) AGAINST('$input') AS score
 FROM interests
 WHERE MATCH(interest_desc) AGAINST('$input')
 ORDER BY score DESC
 LIMIT 10
 ";

 $result = mysql_query($query1) or die(mysql_error());
 while ($row = mysql_fetch_assoc($result)) {
 echo $row['name'];
 echo $row['interest_desc'];
echo $row['date'];
 }

I must be going wrong with my syntax, any pointers? im pulling my hair out over this!

user1064660
  • 97
  • 1
  • 9
  • It looks like a problem with your SQL. Have you run your query against your database (like in phpMyAdmin, or something)? What does `mysql_error()` say, if anything? – Logan Serman Dec 13 '11 at 23:59
  • 1
    The SQL is, in fact, **correct**. Your problem is almost certainly solved in this existing SO post: **[MySQL FULLTEXT Not Working](http://stackoverflow.com/questions/1125678/mysql-fulltext-not-working)** –  Dec 14 '11 at 04:20
  • needed to be in boolean mode. got it working now thanks – DIM3NSION Dec 14 '11 at 05:28

1 Answers1

0

Have you indexed the field as full text and is your table myisam. See this for more detail.