note 30231 deleted from ref.session by didou

From: Date: Sun, 18 May 2003 03:19:02 +0000
Subject: note 30231 deleted from ref.session by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-48363@lists.php.net to get a copy of this message
Note Submitter: tech at opn rdng dot com ---- hey everyone, an important CAUTIONARY TALE that might save you much frustration: when i was setting > $_SESSION[<array>][<key>] = <value>; in my code, i noticed the array disappeared on next page load; within the page load where it was set, accessing $_S[a][k] return <value>, but i'd go to another page and $_S[a] was NULL! I really can't explain why, but $_S[a] had to ALREADY BE AN ARRAY when a key=>value pair was added to it. SO, to make a long story short, since my array was 1-based, I called the declaration > $_SESSION[<array>][0] = "anchor" ; every time the session was initialized on log-in. that way, $_S[a][<int of 1 or more>] would always ADD TO an already existing array, and then the array persisted between pages! hope that helps, __tech

« previous php.notes (#48363) next »