Well, I did as you suggested, and I'm totally lost...
First, I changed the code above to:
function addCartItem($name, $color, $size) {
global $database;
$sql = "SELECT product_id FROM products WHERE product_name='$name' AND product_color='$color' AND product_size='$size' LIMIT 1";
$result = $database->query($sql);
$row = mysql_fetch_array($result);
if(!isset($_SESSION['cart'])) {
$_SESSION['cart'] = '';
}
if(is_array($row)) {
if(is_array($_SESSION['cart'])) {
$_SESSION['cart'][$row['product_id']] = ( $_SESSION['cart'][$row['product_id']] + 1 );
return TRUE;
} else {
print_r($_SESSION);
echo '<p>';
var_dump($_SESSION);
}
} else {
print_r($_SESSION);
echo '<p>';
var_dump($_SESSION);
}
}
And it output this:
Array ( [url] => /dev_site/viewcart.php [cart] => )
array(2) { ["url"]=> &string(22) "/dev_site/viewcart.php" ["cart"]=> string(0) "" }
It works fine on one server, but I move it to a shared hosting environment and this happens...