title: How to create a semantic search
body: <p>I want to create a search box where instead of using a WHERE cluse in the query to match the exact phrase within a field, I want the search box to be able to perform a semantic search so that when the user enters in part of a phrase, it displays suitable results where it is able to match the meaning of a phrase. Exactly how Google works when you try and search through Google. Is this possible to achieve and does anyone have any ideas?</p>
  
  <p>Below is the code I am currently using to be able to use the database to see if a row matches the exact phrase entered within the search box:</p>
  
  <pre><code>  &lt;?php
  
  
      //connected to DB
  
            foreach (array('questioncontent') as $varname) {
              $questioncontent = (isset($_POST[$varname])) ? $_POST[$varname] : '';
            }
  
      ?&gt;
  
  
      &lt;p&gt;Search for a previous question by entering in a phrase in the search box below and submitting the phrase&lt;/p&gt;
  
      &lt;form action="previousquestions.php" method="post" id="modalform"&gt;
            &lt;p&gt;Search: &lt;input type="text" name="questioncontent" value="&lt;?php echo $questioncontent; ?&gt;" /&gt;&lt;/p&gt;
            &lt;p&gt;&lt;input id="searchquestion" name="searchQuestion" type="submit" value="Search" /&gt;&lt;/p&gt;
            &lt;/form&gt;
  
  
      &lt;?php 
                  if (isset($_POST['searchQuestion'])) {
  
                    $questionquery = "SELECT QuestionContent FROM Question
                WHERE(QuestionContent = '".mysql_real_escape_string($questioncontent)."')";
  
            $questionnum = mysql_num_rows($questionresult = mysql_query($questionquery));
  
            if($questionnum !=0){
  
            $output = "";
  
              while ($questionrow = mysql_fetch_array($questionresult)) {
  
      $output .= "
            &lt;table&gt;
            &lt;tr&gt;
            &lt;td&gt;{$questionrow['QuestionContent']}&lt;/td&gt;
            &lt;/tr&gt;";
              }
              $output .= "        &lt;/table&gt;";
  
              echo $output;
  
        }
  
      }
  </code></pre>