title: What is wrong with this code that uses the mysql extension to fetch data from a database in PHP?
body: <p>I want to fetch data from a mysql table using php. Please, can anyone tell me what is wrong with this code? What is the correct code to fetch data from a mysql database:</p>
  
  <pre><code> &lt;?php
      $dbhost = 'localhost';
      $dbuser = 'root';
      $dbpass = '';
      $connect=mysql_connect("localhost","root","");
  
      // connect to databsase 
  
      mysql_select_db("form1",);
  
          enter code here
  
      // query the database 
  
      $query = mysql_query("SELECT * FROM users WHERE name = 'Admin' ");
  
      // fetch the result / convert resulte in to array 
  
      while ($rows = mysql_fetch_array($query)):
  
         $rows = $rows['Name'];
         $address = $rows['Address'];
         $email = $rows['Email'];
         $subject = $rows['Subject'];
         $comment = $rows['Comment'];
  
         echo "$Name&lt;br&gt;$Address&lt;br&gt;$Email&lt;br&gt;$Subject&lt;br&gt;$Comment&lt;br&gt;&lt;br&gt;";
  
         endwhile;
  
         ?&gt;
  </code></pre>