Forum Moderators: coopster
$_SESSION['cid'] = $COOKIE['cid'];
is not getting assigned the value of $COOKIE['cid']?
Thanks.
Below is my code:
function cart_add($product_id,$product_qty){
$cart_id = $this->get_cart_id();
if(!$cart_id){
// If no cart id found generate one
$unique_cid = md5(uniqid(rand (),1));
// Set cart id into the cookie
setcookie('cid',$unique_cid,time()+24*3600*60);
// Register session with cart id value
$_SESSION['cid'] = $COOKIE['cid'];
// If person is a member
// modify their profile with
// cart id in the database
if($_SESSION['login']){
$_SESSION['cid'] = $COOKIE['cid'];
@mysql_query("UPDATE members SET cart_id = '{$_SESSION['cid']}' WHERE id = '".$_SESSION['userid']."'");
}
}