title: MySQL/PHP Search Efficiency
body: <p>I'm trying to create a small search for my site. I've tried using full-text index search, but I could never get it to work. Here is what I've come up with:</p>
  
  <pre><code>if(isset($_GET['search'])) {
  
  $search = str_replace('-', ' ', $_GET['search']);
  $result = array();
  
  $titles = mysql_query("SELECT title FROM Entries WHERE title LIKE '%$search%'");
  while($row = mysql_fetch_assoc($titles)) {
      $result[] = $row['title'];
  }
  
  $tags = mysql_query("SELECT title FROM Entries WHERE tags LIKE '%$search%'");
  while($row = mysql_fetch_assoc($tags)) {
      $result[] = $row['title'];
  }
  
  $text = mysql_query("SELECT title FROM Entries WHERE entry LIKE '%$search%'");
  while($row = mysql_fetch_assoc($text)) {
      $result[] = $row['title'];
  }
  
  $result = array_unique($result);
  }
  </code></pre>
  
  <p>So basically, it searches through all the titles, body-text, and tags of all the entries in the DB. This works decently well, but I'm just wondering how efficient would it be? This would only be for a small blog, too. Either way I'm just wondering if this could be made any more efficient.</p>