insert DB problem
| From: | David Dahl | Date: | Wed, 20 Feb 2002 21:31:03 +0000 |
| Subject: | insert DB problem | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-886@lists.php.net to get a copy of this message | ||
I get this error when inserting records:
DB Error: already exists
i can insert one record, but the second record always fails. If I empty the table, i can insert one record again:
$db = DB::connect($dsn);
if (DB::isError($db)) {
die ($db->getMessage());
}
$insertINV = "INSERT INTO inventory
(keypid,keyfcompanyid,keyfsupplierid,sku,short_name,long_name,description,
qty_on_hand,price,
cost,cost_case,price_case,qty_case,backorder,backorder_time,reorder_level )
VALUES ('$keypid','$companyID','$_POST[keyfsupplierid]','$_POST[sku]','$_POST
[short_name]','$_POST[long_name]'
,'$_POST[description]','$_POST[qty_on_hand]','$_POST[price]','$_POST[cost]
','$_POST[cost_case]','$_POST[price_case]'
,'$_POST[qty_case]','$_POST[backorder]','$_POST[backorder_time]','$_POST[
reorder_level]')";
$keypid = $db->nextId('mysequence');
$insertInventory = $db->query($insertINV);
if (DB::isError($insertInventory)) {
die ($insertInventory->getMessage());
}
I know the sequence is working fine...
tia
david