empList.php
<html><head><meta content="text/html;charset=utf-8" http-equiv="content-type"><title>僱員資訊列表</title></head><?php$conn = mysql_connect ( "localhost", "root", "root" ) or die ( mysql_error () );mysql_query ( "set names utf8" );//選擇資料庫mysql_select_db ( "test", $conn );$sql = "select * from emp";$res = mysql_query ( $sql, $conn );echo "<table width='700px' border='1px'>";echo "<tr><th>id</th><th>name</th><th>grade</th><th>email</th><th>salary</th><td colspan='2'>操作</td></tr>";//這裡我們需要迴圈顯示使用者的資訊while ( $row = mysql_fetch_assoc ( $res ) ) {echo "<tr><td>{$row['id']}</td><td>{$row['name']}</td><td>{$row['grade']}</td>";echo "<td>{$row['email']}</td><td>{$row['salary']}</td>";echo "<td><a href='#'>刪除使用者</a></td>";echo "<td><a href='#'>修改使用者</a></td><tr>";}echo "<h1>僱員資訊列表</h1>";echo "<hr/>";echo "</table>";//關閉資源mysql_free_result($res);mysql_close($conn);?></html>