Get data from database query
<html>
<body>
<ul>
<?php
$cnx = mysql_connect('mysql153.secureserver.net','java2s','password');
mysql_select_db('java2s');
$employees = @mysql_query('SELECT ID, FirstName FROM Employee');
if (!$employees) {
die('<p>Error retrieving employees from database!<br />'.
'Error: ' . mysql_error() . '</p>');
}
while ($employee = mysql_fetch_array($employees)) {
$id = $employee['ID'];
$name = htmlspecialchars($author['Name']);
echo("$name <br>");
echo("$id <br>");
}
?>
</ul>
</p>
</body>
</html>
Related examples in the same category