PHP_MySQL教程-第二天
来源:PHPerz.com 作者:网络转载 发布时间:2007-12-07
// 如果不是修改状态,则显示员工列表
$result = mysql_query("SELECT * FROM employees",$db);
while ($myrow = mysql_fetch_array($result)) {
printf("<a href="%s?id=%s">%s %s</a> n",
$PATH_INFO, $myrow["id"], $myrow["first"], $myrow["last"]);
printf("<a href="%s?id=%s&delete=yes">(DELETE)</a><
br>", $PATH_INFO, $myrow["id"]);
}
}
?>
<P>
<a href="<?php echo $PATH_INFO?>">ADD A RECORD</a>
<P>
<form method="post" action="<?php echo $PATH_INFO?>">
<?php
if ($id) {
// 我们是在编辑修改状态,因些选择一条记录
$sql = "SELECT * FROM employees WHERE id=$id"