将购物车详细信息保存到数据库中 [英] Saving cart details into database
本文介绍了将购物车详细信息保存到数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的意思是像298的2x(这是产品的id)?
解决方案
product_to_cart
+ ---- ----- + ------------ + ----- +
| cart_id | product_id |数量|
+ --------- + ------------ + ----- +
| x | x | x |
...
复合主键包含 cart_id
和 product_id
?
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)?
解决方案
product_to_cart
+---------+------------+-----+
| cart_id | product_id | qty |
+---------+------------+-----+
| x | x | x |
...
With a compound primary key comprising cart_id
and product_id
?
这篇关于将购物车详细信息保存到数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文