this is my code:
if (isset($POST['quantity'])) {
$quantity = $POST['quantity'];
}
if (isset($POST['item_code'])) {
$itemcode = $POST['item_code'];
}
if (isset($POST['modified_hidden'])) {
$modified_hidden = $POST['modified_hidden'];
}
if (isset($POST['modified_quan'])) {
$modified_quan = $POST['modified_quan'];
}
$idno = 'ct_session_id';
$action = $_REQUEST['action'];
switch ($action) {
case "add":
$query = "INSERT INTO getitem (
ct_session_id,
ct_qty,
ct_itemcode)
VALUES ('$idno','$quantity','$itemcode')";
$message = "<div align=\"center\"><strong>Item
added.</strong></div>";
break;
case "change":
$query = "UPDATE getitem
SET ct_qty = '$modified_quan'
WHERE carttemp_hidden = '$modified_hidden'";
$message = "<div align='center'><strong>Quantity
changed.</strong></div>";
break;
case "delete":
$query = "DELETE FROM getitem
WHERE carttemp_hidden = '$modified_hidden'";
$message = "<div align='center'><strong>Item
deleted.</strong></div>";
break;
case "empty":
$query = "DELETE FROM getitem WHERE ct_session_id = '$idno'";
$message = "<div align='center'><strong>Cart
emptied.</strong></div>";
break;
}
$results = mysql_query($query)
or die(mysql_error());
echo $message;
why is it when i run it, it says duplicate entry 0 for key 1?i dont understand..anyone..pls help.