title: How to make a full text search engine with php and mysql?
body: <p>I have created a php search engine by using an open source code. I have created a database and a table with 5 columns:</p>
  
  <p><em>title</em>, <em>description</em>, <em>keywords</em>, <em>link</em>, <em>date</em></p>
  
  <p>The code I'm using is the php code below:</p>
  
  <pre><code>&lt;?php
      $keywords = $_GET ['input'];        
       $keywords = "Led Zeppelin";
  $words = explode(" ",$keyword);
  
  foreach ($words as $w) {
      $keyword_parts .= "+" . $w ." ";
  }
  $keyword_parts = substr($keyword_parts,0,-1);
  $query = "SELECT
            *,
            MATCH (keywords,title) AGAINST ('" . $keywords . "') as score
            FROM search
            WHERE MATCH (keywords,title) AGAINST ('" . $keyword_parts . "' IN BOOLEAN MODE)
            ORDER BY score DESC";
  
      //connect
      mysql_connect ("localhost", "root", "password");
      mysql_select_db("intranet");
  
      $query = mysql_query($query);
      $numrows = mysql_num_rows ($query);
      if($numrows &gt;0){
          while ($row = mysql_fetch_assoc($query)){
              $id = $row ['id'];
              $title = $row ['title'];
              $description = $row ['description'];
              $keywords = $row ['keywords'];
              $link = $row ['link'];
              $date = $row ['date'];
  
              echo "&lt;h2&gt;&lt;a href='$link'&gt;$title&lt;/a&gt;&lt;h2/&gt;
              $description &lt;br /&gt;&lt;br /&gt;";
          }
      }
      else 
          echo "No results found for \"&lt;b&gt;$each&lt;/b&gt;\" ";
  
      //disconnect
      mysql_close();
  ?&gt;
  </code></pre>
  
  <p>The search script works fine, but the only problem is that it searches by keyword which increases the search result, but makes it hard to find what you want because a lot of keywords on different entries match.</p>
  
  <p>Now, I was reading online about full text search ("Full-text searching is performed using MATCH() ... AGAINST syntax. MATCH()") but I don't know how to apply that to my code.</p>