title: Search mysqli for multiple values in one column, return matching another, sort by count of occurrences?
body: <p>Before I start, here is the sample format of the database:</p>
  
  <pre><code>id  date         title            content
  --------------------------------------------------------------
  1   YYYY-MM-DD   some text here   lots of stuff to search here
  2   YYYY-MM-DD   some text here   lots of stuff to search here
  3   YYYY-MM-DD   some text here   lots of stuff to search here
  </code></pre>
  
  <p>I currently have something set up to get the id of a row, then assign the date, title, and content to PHP variables to display in different places on a page (it's a blog, these are posts).</p>
  
  <p>Now I'm trying to make a function that will search the content for each string in an array (the code already splits words entered into the search box by spaces into an array, so entering <code>cat hotdog suit</code> will give <code>[0]cat [1]hotdog [2]suit</code>).</p>
  
  <p>I have a loop set up that performs a query on each of the strings:</p>
  
  <pre><code>foreach ($queryArray as $queryArrayString) {
      // query the content column for $queryArrayString
  }
  </code></pre>
  
  <p>However, I can't figure out what query I should use to find the id of the post that the string occurs in. I'd like to assign it to a variable (<code>$results</code>).
  After reversing the array, so higher ids (newer results) show up first, I'd like to find the titles of each id and store it like this:</p>
  
  <pre><code>id (let's say it is 3) =&gt; matching title
  id (let's say it is 1) =&gt; matching title
  </code></pre>
  
  <p>Is this possible? I've tried several different queries, and none worked, but one took 2 minutes and loads of memory to attempt.</p>
  
  <p>Any help would be appreciated.</p>
  
  <p>EDIT: I've created a text index of the title and content columns (I'd like to search both), shown in <a href="http://i.imgur.com/bTwnwkx.png" rel="nofollow">this image</a>.</p>
  
  <p>Is it possible to search this? Like I've said in the comments, I'd just need it to return the corresponding id and title somehow. (Title for result link text, id for link destination: <code>&lt;a href="blog?p=[id]"&gt;[title]&lt;/a&gt;</code> is the format I'm using</p>