title: How to search MySQL database using MATCH AGAINST method that returns only rows that have a particular field value?
body: <p>I have a MySQL table and one of the fields is "category," the values of which include articles, studies, quotes, etc. For the search form I have checkboxes that correspond with these categories for the user to select which, if not all, to search from.</p>
  
  <p>Right now the following snippet works for searching the entire table indiscriminately (i.e., from rows with "category" including articles, studies, quotes, etc. However, how would I change the following so that if a person selects only "Articles," the query will return only the rows that have the field "category" with the corresponding value?</p>
  
  <pre><code>$category = $_GET["category"];
  $query = "User-submitted query";
  $search = mysql_query("SELECT title,body,
  MATCH(title, body) 
  AGAINST('$query' IN BOOLEAN MODE)
  AS score FROM resources
  WHERE MATCH(title, body) AGAINST ('$query' IN BOOLEAN MODE)");
  </code></pre>
  
  <p>I tried adding in <code>WHERE category = '$category'</code> ($category in this case would be "Articles") above but it did not work.</p>
  
  <p>BTW: I am aware of the mysql/mysqli and security user-input issues.</p>