Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'includes/session.php';
- $po_ID = $_POST['po_ID'];
- $json = $_POST['items'];
- $client_id = $_POST['client_id'];
- $date_reserve = date('Y-m-d');
- $conn = $pdo->open();
- foreach ($json as $key => $value)
- {
- for ($i = 1; $i <= $value["quantity"]; $i++)
- {
- //echo "Model:". $value["model"]. "<br>". "Client ID:". $client_id. "<br>". "PO ID:". $po_ID. "<br>";
- try
- {
- $stmt = $conn->prepare("INSERT INTO backup_sales (po_ID, model_id, client_id, sales_date)
- VALUES (:po_ID, :model_id, :client_id, :sales_date)");
- $stmt->execute(['po_ID'=>$po_ID, 'model_id'=>$value["model"], 'client_id'=>$client_id, 'sales_date'=>$date_reserve]);
- $_SESSION['success'] = "<b>".$po_ID."</b> Edit reserved quantity successfully";
- }
- catch(PDOException $e){
- $_SESSION['error'] = $e->getMessage();
- }
- }
- }
- $pdo->close();
- ?>
Add Comment
Please, Sign In to add comment