Ii have been working on a shopping cart, the way my cart works is that for each item in a users cart the data is stored in a database.
So if the users has a hat and a glove there are 2 rows in my table, the rows are joined using a cart id. So each row has the same value for 'cartid'.
What I want to do is if a user enters a promo code, do updated both cart items with the promo code used.
INSERT INTO cart (promocodes) VALUES ('$code') WHERE id = '$cartid'
I need to loop this query for each instance of that cartid. Any ideas on how this is done.