<html>html
<head>mysql
<meta http-equiv=」Content-Type」 content=」text/html; charset=gb2312″ />sql
<title>第一個PHP頁面-zzarea.com</title>ide
</head>fetch
<body>ui
<?PHPspa
$conn=mysql_connect ("localhost:3306", "root", "111");htm
mysql_select_db("hx_2013",$conn);it
$sql = 'select * from t_info ';table
$result = mysql_query($sql);
echo "<table border='1'>
<tr>
<th>t_id</th><th>t_name</th><th>t_age</th><th>t_sex</th>
</tr>";
while ($row = mysql_fetch_array($result))
{ echo "<tr>";
echo "<td>" . $row['t_id'] . "</td>";
echo "<td>" . $row['t_name'] . "</td>";
echo "<td>" . $row['t_age'] . "</td>";
echo "<td>" . $row['t_sex'] . "</td>";
echo "</tr>";
}
echo "</table>";
?>
</body>
</html>