View Single Post
  #1 (permalink)  
Old June 10th, 2004, 01:13 AM
junemo junemo is offline
Authorized User
 
Join Date: Apr 2004
Location: malacca, malacca, Malaysia.
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to junemo
Default FOREIGN KEY and PRIMARY KEY Constraints

Hi,I hope someone can solve my problem.
When I run my system at browser, it always display error msg about the primary and foreign key constraint.:(

How I want to solve this problem

Error:
Warning: ociexecute(): OCIStmtExecute: ORA-00001: unique constraint (PROD.PK_LINE) violated

Warning: ociexecute(): OCIStmtExecute: ORA-02291: integrity constraint (PROD.FK_NO) violated - parent key not found

Attach code:

<?php
require_once("DB.php");
require_once ("recordset.php");

$connection = OCILogon("prod","prod");

// Create SQL statement and issue query
$stmt = OCIparse($connection,"insert into bill (bill, ship, invdate, invno, po, dn, cur, pri, term) ".
      "values ('$bill', '$ship', '$invdate', '$invno', '$po', '$dn', '$cur', '$pri', '$term')");

$stmt = OCIParse($connection,"insert into item (line, invno, po1, stock1, qty1, uom1, pri1, amo1, total) ".
     "values ('$line', '$invno', '$po1', '$stock1', '$qty1', '$uom1', '$pri1', '$amo1', '$total')");

OCIExecute($stmt,OCI_DEFAULT);
OCILogOff($connection);
?>

Thanks in advance.