i have written a php script that inserts values from a form into a table in a mysql db. upon submitting the form i get the error message" Duplicate entry '' for key 1".
i have no idea what this message means, but i have looked at the form and my query and i dont have any duplicate variable names. can someone please point in the right direction? the php code is below..thanx
davina
<?php
// connecting to the mysql and selecting the proper database
$conn = mysql_connect("DAVINA","davina zedan", null) or die(mysql_error());
mysql_select_db("test",$conn) or die(mysql_error());
//create and issue query
$addSafe=" insert into safe_db
(serialNum, model,enteredBy, dateEntered, location, lastModified, lockType, combination, overrideCode, programmerCode, user1, user2, user3,
user4, user5, user6, user7, user8, user9)
values
('$_POST[serialNum]', '$_POST[model]', now(), '$_POST[enteredBy]',
now(), '$_POST[location]', '$_POST[lockType]', '$_POST[combination]', '$_POST[overrideCode]', '$_POST[programmerCode]', '$_POST[user1]',
'$_POST[user2]', '$_POST[user3]', '$_POST[user4]', '$_POST[user5]', '$_POST[user6]', '$_POST[user7]', '$_POST[user8]', '$_POST[user9]') ";
mysql_query($addSafe, $conn) or die(mysql_error());
//message for user
$msg="The safe $serialNum has been added!";
?>
<html>
<head>
<title>Adding Safe to System</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php print $msg; ?>
</body>
</html>