CodeIgniter Forums

Full Version: unset session data (inside user_data array)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

So I have a 'cart' array inside my session like this

[session_id] => 4a5a5dca22728fb0a84364eeb405b601
[ip_address] =>
[user_agent] => Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7;
[last_activity] => 1303142623
[cart] => Array( [1]=1;
My question, I want to unset one of the id inside cart array..but not the whole 'cart' data

$this->session->unset_userdata($id); //$id as in [cart][$id]
//or even like this below
$tmp = $this->session->userdata('cart');          
I tried the above, but it doesn't do a thing. Help!

So basically I need something like:
as in pure php code

PS: I pass the $id through uri and can echo the $id just fine. I'm not using CI built in shopping cart class as the client has other custom requirement.