FireFly
FireFly

Reputation: 79

Saving cart details into database

I have a cart table which has a relation to a product table that i am using to save user's cart details to db. But i have a problem how can i save quantity of products?

I mean something like 2x of 298 (which is a id of a product)?

Upvotes: 1

Views: 196

Answers (1)

CD001
CD001

Reputation: 8472

product_to_cart

+---------+------------+-----+
| cart_id | product_id | qty |
+---------+------------+-----+
| x       | x          | x   |

...

With a compound primary key comprising cart_id and product_id ?

Upvotes: 1

Related Questions