matthew798 Posted September 29, 2011 Share Posted September 29, 2011 Hey all, Im just wondering what the best way to store a bunch of products numbers under a session id. I have a shopping cart that i want people to be able to add products to it. The product id numbers are around 4 digits each. Im just wondering what the most efficient way to store the cart is. Create an individual table for each session ID and store the products there? Create a table that stores each session ID and add the products in the same collumn then separae them when needed? I cant think of any efficient sounding way to do this. Heres some more info: session_id = 0000001 (for example) **************************** * SESS * PRODUCTS * **************************** *0000001* 1001,1002,1003,1004* **************************** Thats what im thinking of doing now, but im worried about how im going to store carts that have 20 or more products, 20*4+20 commas, im looking at 100+ characters in one collumn... I dunno... What do you guys think? Link to comment https://forums.phpfreaks.com/topic/248116-best-way-to-store-undetermined-amount-of-product-numbers/ Share on other sites More sharing options...
fenway Posted September 29, 2011 Share Posted September 29, 2011 One row per pair. Link to comment https://forums.phpfreaks.com/topic/248116-best-way-to-store-undetermined-amount-of-product-numbers/#findComment-1274082 Share on other sites More sharing options...
requinix Posted September 29, 2011 Share Posted September 29, 2011 ...so it looks like SESS | PRODUCT --------+-------- 0000001 | 1001 0000001 | 1002 0000001 | 1003 0000001 | 1004 Link to comment https://forums.phpfreaks.com/topic/248116-best-way-to-store-undetermined-amount-of-product-numbers/#findComment-1274084 Share on other sites More sharing options...
Muddy_Funster Posted September 30, 2011 Share Posted September 30, 2011 ...so it looks like SESS | PRODUCT --------+-------- 0000001 | 1001 0000001 | 1002 0000001 | 1003 0000001 | 1004 Exactly that. Link to comment https://forums.phpfreaks.com/topic/248116-best-way-to-store-undetermined-amount-of-product-numbers/#findComment-1274372 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.