php - Can't change session value in codeigniter -
this question has answer here:
- codeigniter modifying session data 3 answers
i use session in codeigniter, works can't change value. use function :
$this->session->set_userdata('check', 0);
i must change value of 'check' 0.
why can't ?
my question is, why can't change value session ? , set value first time :
$sess_array = array( 'userid' => $row->userid, 'pseudo' => $row->pseudo, 'check' => $row->check ); $this->session->set_userdata('logged_in', $sess_array);
$sess_array = array( 'userid' => $row->userid, 'pseudo' => $row->pseudo, 'check' => $row->check ); // have set session key 'logged_in' $this->session->set_userdata('logged_in', $sess_array); // session value existing key $arrsession = $this->session->userdata('logged_in'); $arrsession['check'] = 0; $this->session->set_userdata('logged_in', $arrsession);
you need update value shown above.
if wish set 'check' value indicated. need following
$sess_array = array( 'userid' => $row->userid, 'pseudo' => $row->pseudo, 'check' => $row->check ); // note no key specified. $this->session->set_userdata($sess_array); // think can set check value. give try. let me know works. $this->session->set_userdata('check',0);
Comments
Post a Comment