Thank you for your reply.
In my php script first I add data to order table and with help of mysql_insert_id()
I add to table order_item, order_id
for($i=0, i<sum of all items in cart; i++)
{
insert into orders_item (order_id)
VALUE (order_id returned by mysql_inser_id())
}
and than I try this
UPDATE order_item
SET item_id = ( SELECT item_id
FROM cart
WHERE cookie_id=123456781910 limit 1),
qty= (SELECT qty
FROM cart
WHERE cookie_id=123456781910 limit 1)
WHERE order_id=1 limit 1;
DELETE FROM cart
WHERE EXISTS
( select item_id, qty
from order_item
where cart.item_id = order_item.item.id
and cart.qty = order_item.qty limit 1)
And put this statements to for loop (i=0, i<sum of items in cart; i++)
in the end there is only one item in order_item, when I try to change limit to the sum of items in the cart I have an error: subquery returns more than one row,
I don't know how to do this with insert🙁
Could anybody help?