Duplicate Insert
Posted: Tue Apr 21, 2009 6:45 am
I have read a couple of posts on data being inserted twice, but everyone is asking for the code. I am having the same issue. Here is my code:
Can someone let me know why this may be happening?
Thank you,
Paul
Code: Select all
<?php
require('../include/connect.php');
$category = $_POST[category];
$short_desc = htmlspecialchars($_POST[short_desc]);
$part_no = htmlspecialchars($_POST[part_no]);
$vendor = htmlspecialchars($_POST[vendor]);
$unit_price = $_POST[unit_price];
$long_desc = htmlspecialchars($_POST[long_desc]);
$max_qty = $_POST[max_qty];
$qty = $_POST[qty];
$sql="INSERT INTO `item`
(`category_id`,
`short_desc`,
`part_no`,
`vendor`,
`unit_price`,
`long_desc`,
`max_qty`,
`qty`)
VALUES
('$category',
'$short_desc',
'$part_no',
'$vendor',
'$unit_price',
'$long_desc',
'$max_qty',
'$qty')";
mysql_query($sql);
if (!mysql_query($sql))
{
die('Error: ' . mysql_errno() . ", " . mysql_error());
}
mysql_close($con);
header("Location: item.php")
?>Thank you,
Paul