title: Two for each loops for a query
body: <p>I am trying to make a loop for 2 arrays and I run into conflicts where it creates duplicate entries...I figure I am just creating the loop wrong.</p>
  
  <pre><code>        foreach($productIds as $productID){
  
              foreach($qty as $q) {
  $sql = "INSERT INTO orderedProducts (productID, orderID, qty) VALUES 
  ((select productID from products where productID ='$productID'), '$orderID', '$q')";
             execute_query($sql);
  
                   }
             }
  </code></pre>
  
  <p>If I remove the qty loop and just hardcode the qty in it works fine. Is there some sort of way  to combine the two loops?</p>