title: Define a Query in undefined variable.
body: <p>I got my search page error and the server pop up below message:</p>
  
  <blockquote>
    <p>Notice: Undefined variable: query in
    /home/tz005/public_html/COMP1687/search.php on line 64 Minimum length
    is 3</p>
  </blockquote>
  
  <p>Where should I make a correction in the script and how to define query? Here is my php script:</p>
  
  <pre><code>&lt;?php
  
  $min_length = 3; //min length of the search
  
  if(strlen($query) &gt;= $min_length){
  
          $query = htmlspecialchars($query); 
  
          $raw_results = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT * FROM item_information
              WHERE (`itemtitle` LIKE '%".$query."%')") or die(((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)));
  
  
          if(mysqli_num_rows($raw_results) &gt; 0){ // If it find's more than 0 results...
  
              while($results = mysqli_fetch_array($raw_results)){
  
  echo "&lt;p&gt;".$results['itemtitle']."&lt;/p&gt;"; // show's the results..
  
  
              }
  
          }
          else{ // If found nothing..
              echo "No results";
          }
  
      }
      else{ // if length of the search is less than defined on variable...
          echo "Minimum length is ".$min_length;
      }
  ?&gt;
  </code></pre>