以下程式碼, 可加以copy 後, 貼在DreamWaver的程式碼功能中.

------------------------------------------------------------------------------------

connect.php

<?php
$link = mysql_pconnect("localhost","root","123456");
mysql_select_db("schoolDB",$link);
mysql_query("set names utf8");
?>

程式解說:

------------------------------------------------------------------------------------

db_select.php

<?php

require("connect.php");

$result=mysql_query("select * from classmate");
while ($object=mysql_fetch_object($result)) {
echo $object->name."<br>";
}
?>

程式解說:
 1.

------------------------------------------------------------------------------------

db2.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文件</title>
</head>

<body>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="614" height="78" border="1" align="center">
<tr>
<th height="34">學號</th>
<th>姓名</th>
<th>姓別</th>
<th>Email</th>
</tr>
<?php

require("connect.php");

$result=mysql_query("select * from classmate");
while ($object=mysql_fetch_object($result)) {
?>
<tr>
<td><?php echo $object->schnum;?></td>
<td><?php echo $object->name;?></td>
<td><?php echo $object->gender;?></td>
<td><?php echo $object->email;?></td>
</tr>
<?php
}
?>
</table>
</body>
</html>


程式解說:
 1.

------------------------------------------------------------------------------------