php - syntax error in case 'remove' when decrementing -
I get a syntax error on "Delete". I was trying to fix it, but I could not understand it. Can anyone tell me how to fix it? Thanks
The code is for an online shop shopping cart
switch ($ action) {case "add": if (isset ($ _SESSION ['train'] [ $ Id])) $ _SESSION ['cart'] [$ id] ++; And $ _SESSION ['cart'] [$ id] = 1; break; ($ $ _ Session = 'cart'] [$ id]) ($ _SESSION ['cart'] [$ id] -; (enter error if) ($ _SESSION ['cart'] [$ id] == 0 ) Unset ($ _ session ['cart'] [$ id]);) break; Case "Empty": Unset ($ _ session ['cart']); break; } You use brackets instead of brackets for your IF statement ($ _ Session ['cart'] [$ id]) (& lt; - $ _SESSION ['cart'] [$ id] - here
; (Error here) ($ _SESSION ['cart'] [$ id] == 0) Unset ($ _ session ['cart'] [$ id]);) & lt; - here
Comments
Post a Comment