note 68341 deleted from ref.session by nlopess

From: Date: Mon, 24 Jul 2006 08:43:48 +0000
Subject: note 68341 deleted from ref.session by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-115075@lists.php.net to get a copy of this message
Note Submitter: drs at berkeley dot edu Reason: useless ---- I am reasonably confident I'm doing something wrong, but on the off chance that I'm wrong about that... I was losing $_SESSION between script calls. I would load it up like this: <?php $result = @mysql_query($query) $data = mysql_fetch_array( $result ) ; while ( list ( $key, $value ) = each ( $data ) ) $_SESSION[$key] = $value; $_SESSION['valid_user'] = $logname; session_write_close(); ?> and after a second call to the script the only thing left in $_SESSION would be the 'valid_user' entry, i.e. the one entered "manually", rather than by going through the $data array. Well... it turns out that $data has two sets of $values, one complete set indexed by strings, and another indexed by integers. Having both sets loaded into $_SESSION seems to cause huge problems, but if I do this: <?php while ( list ( $key, $value ) = each ( $data ) ) if ( ! is_numeric( $key ) ) $_SESSION[$key] = $value; ?> then everything is magically all better. *That* only took a few hours to figure out. Hope this helps someone. *shrug* -- drs

« previous php.notes (#115075) next »