1

So I have this CART table which stores the selected items of the customer and ORDER table which stores the ordered items of the customer, obviously, I would like to transfer/add the selected item of the customer to the ORDER table. I want to do it like INSERT INTO (array of product_names,size,price,etc..) into the ORDER table because customers can have multiple items in the cart. I really need your help :|

$query=mysql_query("select * from cart where user_id =$session_id");
while($row=mysql_fetch_assoc($query)){
    $cartItems = array('user_id'=$row[user_id],'product_name'=>$row['product_name'],     'price'=>$row['price'], 'size'=>$row['size']);
}
4

1 回答 1

0

You could another database for that, say ORDER DB and ORDERED _ITEMS table then when you insert items in the ORDERED_ITEMS table you can use mysql_insert_id() and insert the user_id into the ORDERD DB and from there you can join the two tables

于 2013-10-27T21:15:07.453 回答