can only seem to access $_SESSION from one model object |
[eluser]jmadsen[/eluser]
Hi, I am unable to use the CI session lib because I am trying to work with a multi-dim array in my session variables, so I am switching over to normal sessions. However, I'm having a problem. my main Controller, I load Code: parent::Controller(); Inside page_model functions I can access the $_SESSION var, but from the other model, the controller, or views I always get this error: "Severity: Notice Message: Undefined variable: _SESSION" I AM autoloading the session lib still, but am NOT calling session_start() from anywhere (nor does adding it seem to make any difference). It seems strange that it is not an "all or nothing". The only thing I can think of is that my $_SESSION is really a class variable, and is just fooling me. In which case, how should I be setting this up correctly? Any idea what I should be looking for? Thanks, jeff
[eluser]jmadsen[/eluser]
I got it: http://ellislab.com/forums/viewthread/121776/ I DID need to use session_start(), but couldn't find the right place to put it. All happy now!
[eluser]brianw1975[/eluser]
I take it that this way isn't sufficient? Code: $user_info = array("test"=>array("unit1"=>"1","unit2"=>"2"));
[eluser]jmadsen[/eluser]
not really. my array looks more like this: Code: $user_info = array("test"=>array("unit1"=>"1","unit2"=>"2","unit3"=>array("try1"=>2,"try2"=>4))); and I am looping through certain parts of the different levels at different times, so having to keep passing it into intermediary vars like your suggestion is cludgy. I know I could write something to do it, but why bother when I have the $_SESSION? There's no login or personal data involved, and I've never had any issues with $_SESSION. I've seen a suggestion for some code to allow something like: Code: $this->session->set_userdata('test'['unit3'][$try_var]); that's what I am really after. |
Welcome Guest, Not a member yet? Register Sign In |