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:
<?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<br>$Address<br>$Email<br>$Subject<br>$Comment<br><br>";
endwhile;
?>