Hi.
I am trying to either set an array or update the current array that is held within a session - for some reason it isnt working and is throwing a error (Warning: array_push() expects parameter 1 to be array, integer given in C:\xampp\htdocs\site\folder\cart.php on line 41)
This is the code
if(empty($_SESSION['cart']))
{
echo "empty session <br>";
$cartData = array('itemId' => $articleId, 'itemTitle' => $articleTitle);
$_SESSION['cart'] = $cartData;
}
else
{
echo "full session <br>";
$cartData = $_SESSION['cart'];
$cartData = array_push($cartData,$articleId,$articleTitle);
$_SESSION['cart'] =$cartData;
}
echo "The END: <br>";
echo "<pre>";
print_r($_SESSION['cart']);
echo "</pre>";
//echo "<pre>";
//echo $where . "<br>";
//print_r($_SESSION['cart']);
//echo "</pre>";
so far its very simple, I am checking to see if the session is set and if not I create the inital array and assign it to the session there after I should just be pushing into the array and updating the session but as said it throwing the above error.
What am I doing wrong!
Cheers
Chris