Welcome Guest, Not a member yet? Register   Sign In
adding to existing session
#7

[eluser]Randy Casburn[/eluser]
[quote author="nuttynibbles" date="1223499079"]yup that was what i did. I took out the array and insert new value. But instead of adding new row of value, it overwrite the previous value.

the above code i posted is what i have done.[/quote]

Wow....This is much less a CI session thing than a basic array thing...

@NuttY -- have you ever heard of array_pop, array_push, array_shift, and array_unshift ?

Code:
/*controller*/
//when button is pressed to insert new value
if($this->input->post('postvalue')=="2"){
  //generate unique id
  $uniqueid=uniqueid(date('Y-m-d h:i:s:u'),'helloworld');
  $newSession = ($this->session->userdata('sessiontag') != '' )? $this->session->userdata('sessiontag') : array() ;
  array_push($newSession, $uniqueid);
  $this->session->set_userdata('sessiontag',$newSession);
}

You can test this as I'm not exactly sure this will work, but this will get you darn close.

Try this please.

Randy


Messages In This Thread
adding to existing session - by El Forum - 10-03-2008, 11:55 AM
adding to existing session - by El Forum - 10-03-2008, 12:14 PM
adding to existing session - by El Forum - 10-07-2008, 09:32 PM
adding to existing session - by El Forum - 10-08-2008, 05:33 AM
adding to existing session - by El Forum - 10-08-2008, 06:37 AM
adding to existing session - by El Forum - 10-08-2008, 09:51 AM
adding to existing session - by El Forum - 10-08-2008, 10:33 AM
adding to existing session - by El Forum - 10-09-2008, 01:31 AM
adding to existing session - by El Forum - 10-09-2008, 08:03 AM
adding to existing session - by El Forum - 10-12-2008, 03:37 AM



Theme © iAndrew 2016 - Forum software by © MyBB