title: PHP search script for mySQL database, only 3 letter working
body: <p>I am trying to do a php search into mySQL database. the following code works funny, it detect very well when I only entered 3 letter..eg i have a product name 'deepbluehealth omega' if i type 'ome' it picked up, if i type 'ega' it picked up, if i type 'omega' no result shown, also if i type 'deepbluehealth' it pick up no problem. </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 id, product_name FROM products WHERE product_name LIKE '%$searchquery%' OR details LIKE '%$searchquery%') ";
      } 
      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;
  &lt;/html&gt;
  </code></pre>