title: Php Search Script only pick up the first word
body: <p>As the question, it only picked up the first word in my product_name which has var_char(50) as primary key.</p>
  
  <pre><code>&lt;?php
  error_reporting(E_ALL);
  ini_set('display_errors', '1');
  $search_output = "";
  if(isset($_POST['searchquery']) &amp;&amp; $_POST['searchquery'] != ""){
      $searchquery = $_POST['searchquery'];
      if($_POST['filter1'] == "Whole Site"){
      $sqlCommand = "SELECT * FROM products WHERE MATCH (product_name ,details,category,subcategory) AGAINST ('".$searchquery."' IN BOOLEAN MODE)";
      } 
      require_once("storescripts/connect_to_mysqli.php");
      $query = mysqli_query($myConnection,$sqlCommand) or die(mysqli_error($myConnection));
      $count = mysqli_num_rows($query);
      if($count &gt; 1){
          $search_output .= "&lt;hr /&gt;$count results for &lt;strong&gt;$searchquery&lt;/strong&gt;&lt;hr /&gt;$sqlCommand&lt;hr /&gt;";
          while($row = mysqli_fetch_array($query)){
                  $id=$row["id"];
              $product_name = $row["product_name"];
                      $details= $row["details"];
                  $category=$row["category"];
                  $subcategory=$row["subcategory"];
              $search_output .= "ID: $id &lt;br/&gt; Name: $product_name -&lt;br/&gt;$details&lt;br /&gt;$category&lt;br/&gt;$subcategory&lt;br/&gt;
  &lt;a href='product.php?id=$id'&gt;link&lt;/a&gt;&lt;br/&gt;
  
  ";
          } // close while
      } else {
          $search_output = "&lt;hr /&gt;0 results for &lt;strong&gt;$searchquery&lt;/strong&gt;&lt;hr /&gt;$sqlCommand";
      }
  }
  ?&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h2&gt;Search the Exercise Tables&lt;/h2&gt;
  &lt;form action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" method="post"&gt;
  Search For: 
    &lt;input name="searchquery" type="text" size="44" maxlength="88"&gt; 
  Within: 
  &lt;select name="filter1"&gt;
  &lt;option value="Whole Site"&gt;Whole Site&lt;/option&gt;
  
  &lt;/select&gt;
  &lt;input name="myBtn" type="submit"&gt;
  &lt;br /&gt;
  &lt;/form&gt;
  &lt;div&gt;
  &lt;?php echo $search_output; ?&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>
  
  <p>is this due to that it is a primary key? It actually not working for details as well, it actually very weird, not working for most words but work for some..i am totally confused..it is not making any senses</p>
  
  <pre><code>&lt;?php
  error_reporting(E_ALL);
  ini_set('display_errors', '1');
  require_once("storescripts/connect_to_mysqli.php");
  $search_output = "";
  
  if(isset($_POST['searchquery']) &amp;&amp; $_POST['searchquery'] != ""){
      $searchquery = $_POST['searchquery'];
      if($_POST['filter1'] == "Whole Site"){
  $sqlCommand = sprintf("SELECT * FROM products WHERE product_name LIKE '%s%%'",
                 mysqli_real_escape_string($myConnection, $searchquery));
      } 
  
      $query = mysqli_query($myConnection,$sqlCommand) or die(mysqli_error($myConnection));
      $count = mysqli_num_rows($query);
      if($count &gt; 1){
          $search_output .= "&lt;hr /&gt;$count results for &lt;strong&gt;$searchquery&lt;/strong&gt;&lt;hr /&gt;$sqlCommand&lt;hr /&gt;";
          while($row = mysqli_fetch_array($query)){
                  $id=$row["id"];
              $product_name = $row["product_name"];
                      $details= $row["details"];
                  $category=$row["category"];
                  $subcategory=$row["subcategory"];
              $search_output .= "ID: $id &lt;br/&gt; Name: $product_name -&lt;br/&gt;$details&lt;br /&gt;$category&lt;br/&gt;$subcategory&lt;br/&gt;
  &lt;a href='product.php?id=$id'&gt;link&lt;/a&gt;&lt;br/&gt;
  
  ";
          } // close while
      } else {
          $search_output = "&lt;hr /&gt;0 results for &lt;strong&gt;$searchquery&lt;/strong&gt;&lt;hr /&gt;$sqlCommand";
      }
  }
  
  
  
  
  
  ?&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h2&gt;Search the Exercise Tables&lt;/h2&gt;
  &lt;form action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" method="post"&gt;
  Search For: 
    &lt;input name="searchquery" type="text" size="44" maxlength="88"&gt; 
  Within: 
  &lt;select name="filter1"&gt;
  &lt;option value="Whole Site"&gt;Whole Site&lt;/option&gt;
  
  &lt;/select&gt;
  &lt;input name="myBtn" type="submit"&gt;
  &lt;br /&gt;
  &lt;/form&gt;
  &lt;div&gt;
  &lt;?php echo $search_output; ?&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I tried above code as well and narrow down to product_name, it still not showing eg I have this product_name entered as 'omega fish' if i type 'fish' it doesn't show a single thing, if i type'omega' then it works</p>
  
  <p>I have given this up and tried with the LIKE function and it seems to be better but still funny..please refer to this link for those that's interested</p>
  
  <p><a href="https://stackoverflow.com/questions/18187221/php-search-script-for-mysql-database-only-3-letter-working">PHP search script for mySQL database, only 3 letter working</a></p>
  
  <p>Thanks</p>