In the below code I am able to create session and add first item in array. But I am not able to append the array in it. I am new to codigniter
function guestcart($pID){
$session = $this->session->userdata('guest');
if(!empty($session)){
$addprod = $data;
$addprod= array($pID);
array_push($addprod,$data);
echo 'Session Exist';
}
else {
//set the session data
$data = array("guest",$pID);
$session = $this->session->set_userdata('guest',$data);
echo 'Session created';
}
}