03.
<head>
04.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=windows-874"
/>
05.
<title>Untitled Document</title>
06.
</head>
07.
08.
<body>
09.
<?php
10.
mysql_connect(
"localhost"
,
"root"
,
"1234"
);
11.
mysql_select_db(
"aaa"
);
12.
13.
$sql
=
"SELECT * FROM aaa;"
;
14.
$result
= mysql_query(
$sql
);
15.
if
(!
$result
) {
16.
echo
"เกิดข้อผิดพลาดในการอ่านข้อมูล"
;
17.
}
18.
else
if
(mysql_num_rows(
$result
) == 0) {
19.
echo
"ไม่มีข้อมูลในตาราง aaa"
;
20.
}
21.
else
{
22.
echo
"<table border=1 cellpadding=3>"
;
23.
24.
25.
while
(
$data
= mysql_fetch_array(
$result
)) {
26.
echo
"<tr> "
;
27.
echo
"<td>{$data['id']}</td><td>{$data['name']}</td>"
;
28.
echo
"</tr>"
;
29.
}
30.
31.
echo
"</table>"
;
32.
}
33.
?>
34.
</body>
35.
</html>