title: PHP Deleting multiple rows with returning values to another table
body: <p>I have a code here that deletes a single row of data from <code>sales_order</code> and then returns the value of the <code>qty</code> to the products table.</p>
  
  <pre><code>&lt;?php
      include('connect.php');
      //get values from href
      $id=$_GET['id'];
      $invoice=$_GET['invoice'];
      $qty=$_GET['qty'];
      $product=$_GET['product'];
  
      //returns quantity to stock
      $sql = "UPDATE products
              SET stock=stock+?
              WHERE productid=?";
      $q = $db-&gt;prepare($sql);
      $q-&gt;execute(array($qty,$product));
  
      //execute query
      $result = $db-&gt;prepare("DELETE FROM sales_order WHERE transaction_id= :id");
      $result-&gt;bindParam(':id', $id);
      $result-&gt;execute();
      header("location:pos.php?invoice=$invoice");
  ?&gt;
  </code></pre>
  
  <p>Now what I'm aiming to do here is to have a reset button that will delete all rows with the same invoice number from sales_order and then each row returns the quantity value to the products table. I can't seem to find a way to do it. Can anyone help me?</p>