我正在编写客户数据库脚本。当我想实现可以编辑、删除和查看每个条目详细信息的“管理客户”站点时,我遇到了一个奇怪的问题。一切都按预期工作,但 ID 字段为空且无处添加。
我有以下代码:
<?php
$qresult = mysql_query("SELECT ID , FirstName, LastName, Company FROM hs_customers");
echo "<table class='coverview' border='0' width='100%' cellpadding='0' cellspacing='0'>";
echo "<th>FirstName</th>
<th>LastName</th>
<th>Company</th>
<th>Options</th>";
while($row = mysql_fetch_array($qresult))
{
echo "<tr>";
echo "<td>" . $row['FirstName'] . "</td>" .
"<td>" . $row['LastName'] . "</td>" .
"<td>" . $row['Company'] . "</td>" .
"<td>" . "<a href='?action=details&id='" . $row['ID'] . "'>Details</a>" . " " .
"<a href='?action=edit&id='" . $row['ID'] . "'>Edit</a>" . " " .
"<a href='?action=delete&id='" . $row['ID'] . "'>Delete</a>" . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>