I have these set of queries, its working fine except that I'm only able to get one value from LAST_INSERT_ID() in my UPDATE query;
$query .= "INSERT into itemorders
(itemID,colourID,itemName,itemSize,itemPrice,quantity,orderID) SELECT
itemID,colourID,itemName,itemSize,itemPrice,quantity,
LAST_INSERT_ID() FROM mycart WHERE email='".$email."'; ";
$query .= "UPDATE CatalogueItemsSize p
INNER JOIN itemorders i ON p.size = i.itemSize AND p.colourID =
i.colourID SET p.quantity = p.quantity - i.quantity WHERE i.id =
LAST_INSERT_ID();";
I understand that it can only retrieve the last single inserted row, how do I loop this so that I am able to catch all the values inserted in the first query?
Currently it is only subtracting quantity one row from the CatalogueItemsSize Table.