edgustaf Posted May 31, 2010 Share Posted May 31, 2010 Can anyone help me figure out this problem i am receiving this error. Fatal error: Cannot increment/decrement overloaded objects nor string offsets in /home/edgustaf/public_html/cit313/showcart.php on line 46 [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/203465-simple-php-shopping-cart/ Share on other sites More sharing options...
shadiadiph Posted June 1, 2010 Share Posted June 1, 2010 don't know but i think try this part of what you have not sure but give it a try if($_SESSION['cart']) { $product_id=0; switch($action) { case "add": $product_id++; if (isset($_SESSION['cart'][$product_id])){ $_SESSION['cart'][$product_id];} else {$_SESSION['cart'][$product_id]=1;} break; case "remove": $product_id = $product_id -1; if (isset($_SESSION['cart'][$product_id])) $_SESSION['cart'][$product_id]; if ($_SESSION['cart'][$product_id]==0) unset($_SESSION['cart'][$product_id]); break; case "empty": unset($_SESSION['cart']); break; } } Link to comment https://forums.phpfreaks.com/topic/203465-simple-php-shopping-cart/#findComment-1065976 Share on other sites More sharing options...
shadiadiph Posted June 1, 2010 Share Posted June 1, 2010 you may also have to unset() the session before renaming it Link to comment https://forums.phpfreaks.com/topic/203465-simple-php-shopping-cart/#findComment-1065977 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.