Undefined variable: id “的错误
<html>
<body>
<?php
$connect=mysql_connect("localhost","root");
$db=mysql_select_db("emp",$connect);
if($id)
{
$result=mysql_query("SELECT*FROM emp WHERE id=$id",$db);
$myrow=mysql_fetch_array($result);
printf("firstname:%s",$myrow["first"]);
printf("lastname:%s",$myrow["last"]);
printf("thisaddress:%s",$myrow["address"]);
}else
{
if($result=mysql_query("SELECT*FROM emp",$db))
{
do{
$myrow=mysql_fetch_array($result);
printf("<a href=\"%s?id=%s\">%s%s</a><br>",$PATH_INFO="PHP.PHP",$myrow["id"],$myrow["first"],$myrow["last"]);
}while($result=mysql_query("SELECT*FROM emp",$db));
}else
{
echo "sorry";
}
}
?>
</body>
</html>
以上的代码为何出现这样的错误呢???
Notice: Undefined variable: id in F:\7.3\php.php on line 6