Jump to content

Cart sessions


raptor30506090

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.