title: php code for mysql connection not executing
body: <p>The following is source of one html file I made containing PHP-MySQL connection and data retrieval code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Home&lt;/title&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;?php
  $servername = "localhost";
  $username = "root";
  $password = "pass123";
  $dbname = "mydb1";
  
  // Create connection
  $conn = new mysqli($servername, $username, $password, $dbname);
  // Check connection
  if ($conn-&gt;connect_error) {
      die("Connection failed: " . $conn-&gt;connect_error);
  }
  
  $sql = "SELECT impath, facenm, descp FROM fac_tab";
  $result = $conn-&gt;query($sql);
  
  if ($result-&gt;num_rows &gt; 0) {
  // output data of each row
  while($row = $result-&gt;fetch_assoc()) {
      echo "&lt;br&gt; impath: ". $row["impath"]. " - Name: ". $row["facenm"]. "     " . $row["descp"] . "&lt;br&gt;";
  }
  } else {
  echo "0 results";
  }
  
  $conn-&gt;close();
  ?&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>but when I open the above .htm file in Mozilla Firefox browser keeping my system's MySQL server open, I do not get the data retrieved from the mydb1 database but instead get the following display by the browser:</p>
  
  <pre><code>connect_error) { die("Connection failed: " . $conn-&gt;connect_error); } $sql = "SELECT impath, facenm, descp FROM fac_tab"; $result = $conn-&gt;query($sql); if ($result-&gt;num_rows &gt; 0) { // output data of each row while($row = $result-&gt;fetch_assoc()) { echo "
  impath: ". $row["impath"]. " - Name: ". $row["facenm"]. " " . $row["descp"] . "
  "; } } else { echo "0 results"; } $conn-&gt;close(); ?&gt; 
  </code></pre>
  
  <p>what is the problem?</p>