beginTransaction(); $sql = "INSERT INTO {$DB}.{$tablename} (prodcode, item_name, item_div, spec, unit, unitprice, searchtag) VALUES (?, ?, ?, ?, ?, ?, ?)"; $stmh = $pdo->prepare($sql); $stmh->bindValue(1, $prodcode); $stmh->bindValue(2, $item_name); $stmh->bindValue(3, $item_div); $stmh->bindValue(4, $spec); $stmh->bindValue(5, $unit); $stmh->bindValue(6, $unitprice); $stmh->bindValue(7, $searchtag); $stmh->execute(); $pdo->commit(); } catch (PDOException $Exception) { $pdo->rollBack(); echo json_encode(["error" => $Exception->getMessage()]); exit; } } } echo json_encode(["status" => "success"]); ?>