View Full Version : fulltext search syntax and error

11-20-2011, 02:53 AM
I'm trying to figure out how to build a fulltext search and I'm not sure if I've built my query right. I'm getting this error: Query failed: Unknown column 'searched term' in 'field list'"

Which is confusing, because I' thought that spot is where you put the searched term - not a column.

$item = $_REQUEST['searched_term'];
$query = "SELECT *, MATCH(scientific_name, common_name_english) AGAINST ($item) AS score from table WHERE MATCH (scientific_name, common_name_english) AGAINST($item) order by score desc";
//$data = mysql_query("SELECT * FROM table WHERE common_name_english LIKE '%$item%'");

$data = mysql_query($query);
if ($data === FALSE) {
die("Query failed: " . mysql_error());

11-20-2011, 03:03 AM
nevermind... it seems it was just a lack of apostrophes around the variable $item