Welcome Guest, Not a member yet? Register   Sign In
How to clear/unset particular session data only?
#1

[eluser]bsrbvr[/eluser]
Hi,
I was created session with two arrays in two different functions inside controller. I want to unset/destroy only part of the data from session. Here in this case I want to destory only fruits array data from session.

public function showdemo(){
$singlearray = array('car' => 'maruti', 'area' => 'mumbai';
$this->session->set_userdata($singlearray );
}
public function showResult(){
$fruits = array('fruit' => 'mango', 'color' => 'green';
$this->session->set_userdata($fruits );
}
I tried with this.
<? unset_userdata($fruits) ?>
but it not works.what is the way to do this?

Thanks.
#2

[eluser]Matalina[/eluser]
Code:
$this->session->unset_userdata('fruit');




Theme © iAndrew 2016 - Forum software by © MyBB