raptor30506090 Posted June 28, 2012 Share Posted June 28, 2012 Hi Guys Here is a quick question im just making my first shopping cart can any one tell me the best way to start cart sessions <?php session_start(); if(!isset($_SESSION['cart'] = $new)){ $_SESSION['cart'] = $new; }else $_SESSION['cart']++; ?> is this wrong or write Many thanks DAZ Link to comment https://forums.phpfreaks.com/topic/264925-cart-sessions/ Share on other sites More sharing options...
memfiss Posted June 28, 2012 Share Posted June 28, 2012 wtf is it ? if(!isset($_SESSION['cart'] = $new)) #php makes ur code step by step #first step $_SESSION['cart'] = $new #where is $new variable ? #if no varable $_SESSION['cart'] will be null #then we check if (!isset(null)) #its true if (true) $_SESSION['cart'] = $new; #and again $_SESSION['cart'] will be null where is declarated $new variable ? Link to comment https://forums.phpfreaks.com/topic/264925-cart-sessions/#findComment-1357679 Share on other sites More sharing options...
raptor30506090 Posted June 28, 2012 Author Share Posted June 28, 2012 Sorry memfiss i feel a bit dumb iv used switch now to fix my problem well on the way were the solved button gone? Link to comment https://forums.phpfreaks.com/topic/264925-cart-sessions/#findComment-1357706 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.