raptor30506090 Posted July 5, 2012 Share Posted July 5, 2012 Hi guys how do i get the content from this <?php $_SESSION['cart'][$productId][] = array('quantity' => $quantity, 'size' => $size, 'color' => $color, 'price' => $price); ?> Link to comment https://forums.phpfreaks.com/topic/265239-session-array/ Share on other sites More sharing options...
ManiacDan Posted July 5, 2012 Share Posted July 5, 2012 Dude, you are killing me. You have to read the manual chapter on arrays. You have to. The array is PHP's strongest and most powerful feature. The short answer is: You access the cart just like you would any other array. The line I gave you is putting that information at the end of the array in $_SESSION['cart'][$productId]. Link to comment https://forums.phpfreaks.com/topic/265239-session-array/#findComment-1359298 Share on other sites More sharing options...
raptor30506090 Posted July 5, 2012 Author Share Posted July 5, 2012 Im really sorry about me being a gimp i can access arrays but the session bit as me read thats al iv been doing i now i need lot more practice but im trying thanks for your reply do i use a for or foreach loop? like i say sorry and thanks for your help Link to comment https://forums.phpfreaks.com/topic/265239-session-array/#findComment-1359301 Share on other sites More sharing options...
ManiacDan Posted July 5, 2012 Share Posted July 5, 2012 both for and foreach would work here. Link to comment https://forums.phpfreaks.com/topic/265239-session-array/#findComment-1359354 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.