I am at scripting a customer database. When I wanted to implement the "manage customers" site where you can edit, delete and view details of each entry, I encountered a strange problem. Everything works like expected, but the ID field is left empty and added nowhere.
I have the following code:
<?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);
?>