title: get no result when running query from text file to fetch data from my table using phpmyadmin
body: <p>I am trying to query some data from my table in mysql by reading a txt file in php, so far, I have the data pulling out of the txt file,but get no result </p>
  
  <p>below is my code:</p>
  
  <pre><code>$dbhost = "localhost";
  
  $dbutilisateur = "root";
  
  $dbpasse = "";
  
  $dbnom = "citweb";
  
  
  $conn = new mysqli( $dbhost , $dbutilisateur, $dbpasse , $dbnom);
  
  // Check connection
  if ($conn-&gt;connect_error) {
  die("Connection failed: " . $conn-&gt;connect_error);
  } 
  
  
     $handle = fopen("List.txt", "r");
     if ($handle) {
     while (($buffer = fgets($handle, 4096)) !== false) {
        $buffer = str_replace("\n", "", $buffer);
       if (preg_match('/(?&lt;=\:).*/', $buffer, $group)) {
           $match = trim($group[0] ); // remove the space
           var_dump($match);                   
  
       }
  }
   $sql = "SELECT * FROM servers
            WHERE cpu_manufacturer = $match";  
  
  
           var_dump ($sql);     
            $result = $conn-&gt;query($sql);
  
            if ($result-&gt;num_rows &gt; 0) {
          // output data of each row
      while($row = $result-&gt;fetch_assoc()) {
      echo "cpu_manufacturer: " . $row["cpu_manufacturer"]. "&lt;br&gt;";
              }
          } else {
              echo "0 results";
          }
  
  
  if (!feof($handle)) {
      echo "Error: unexpected fgets() fail\n";
  }
  fclose($handle);
  $conn-&gt;close();
  }
  </code></pre>
  
  <p>Below is the content of text file:</p>
  
  <pre><code>   cpu_manufacturer: AMD
     cpu_freq (GHz): 333
     cpu_model: Xeon E3-1230v2
     ram(GB): 256
     operating_system: Linux(CentOS)
     hdd_type: SSD
     hdd_capacity(GB):300
      Server Location: usa
  </code></pre>
  
  <p>below is the result that I get so far when using var_dump:</p>
  
  <pre><code>string(3) "AMD" string(3) "333" string(14) "Xeon E3-1230v2" string(3) "256" 
  string(13) "Linux(CentOS)" string(3) "SSD" string(3) "300" string(3) "usa" 
  string(64) "SELECT * FROM servers WHERE cpu_manufacturer = usa" 
  </code></pre>
  
  <blockquote>
    <p>Notice: Trying to get property of non-object in C:\xampp1\htdocs\fetchservers\index2.php on line 42</p>
  </blockquote>
  
  <p>So nothing is in <code>$result-&gt;num_rows</code> it is less than zero...</p>