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.
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);
}
}
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?