主题:  请教一个页内参数传递的问题

tjj110

职务:普通成员
等级:1
金币:0.0
发贴:4
#12004/7/2 17:12:06
点击列表的链接,总是出来原来的页面(http://127.0.0.1/),地址上的参数变了(http://127.0.0.1/?id=3),但是页面内容不变,怎么回事?
<style type="text/css">
<!--
body {
    font-size: 9pt;
}
-->
</style>
<?php

$db = mysql_connect("192.168.0.2", "root";

mysql_select_db("mysql",$db);

if ($id)

{ $result = mysql_query("SELECT * FROM employees WHERE id=$id",$db);

$myrow = mysql_fetch_array($result);

printf("&nbsp;&nbsp;名: %s\n", $myrow["first"]);echo"<br>";

printf("&nbsp;&nbsp;姓: %s\n", $myrow["last"]);echo"<br>";

printf("住址: %s\n", $myrow["address"]); echo"<br>";

printf("职位: %s\n", $myrow["position"]);

}
else
{

// show employee list
// 显示员工列表

$result = mysql_query("SELECT * FROM employees",$db);

if ($myrow = mysql_fetch_array($result)) {

// display list if there are records to display
// 如果有记录,则显示列表

do {

printf("<a href=\"%s?id=%s\">+%s %s</a>\n", $PATH_INFO, $myrow["id"], $myrow["first"], $myrow["last"]);

echo"<br>";
} while ($myrow = mysql_fetch_array($result));

}
}

?>



Mike

职务:版主
等级:6
金币:11.0
发贴:5148
#22004/7/5 16:08:43
printf("<a href=\"%s?id=%s\">+%s %s</a>\n", $PATH_INFO, $myrow["id"], $myrow["first"], $myrow["last"]);

printf("<a href=index.php\"%s?id=%s\">+%s %s</a>\n", $PATH_INFO, $myrow["id"], $myrow["first"], $myrow["last"]);





127.0.0.1/?id=3
|
|
|
localhost/index.php?id=3
试一下