-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hey, Try: - ----------------- foreach ($_SESSION as $k => $v) { if(($k != 'errmsg') && ($k != 'errcount')) { unset($_SESSION[$k]); } } - ----------------- HTH! ~Paul
On Wednesday 16 October 2002 04:04 am, Paonarong Buachaiyo wrote: > Please, I' also have some question about $_SESSION. > > Simple, how can we earse all $SESSION variable except one or two variables. > > Beacuse i want to show some error message in my login form when login > failed. i want to destroy all other $_SESSION variable (about 10) except > $_SESSION['errmsg'] and $_SESSION['errcount']. > > Any way to do it except > > unset($_SESSION['xx1']); > unset($_SESSION['xx2']); > unset($_SESSION['xx3']); > . > unset($_SESSION['xx10']); > > Please, > Pao > > "John W. Holmes" <[EMAIL PROTECTED]> wrote in message > 000501c274a4$ed28ae40$7c02a8c0@coconut">news:000501c274a4$ed28ae40$7c02a8c0@coconut... > > > > Hi All, > > > still trying to update old code. Am I using $_SESSION properly? > > > > > > <snip> > > > if (mysql_num_rows($res) ==1){ > > > /* If correct start session*/ > > > session_start(); > > > $_SESSION['SESSION_UNAME']; > > > $SESSION_UNAME = $user; > > > > > > header("Location: welcome.php"); > > > mysql_free_result ($res); > > > </snip> > > > > Nope. Just use $_SESSION['SESSION_UNAME'] = $user; > > > > You can treat $_SESSION just as you would any other array. > > > > $_SESSION['something'] = "whatever"; > > > > etc... Then, on any page with session_start(), you have the whole > > session array available to you, no matter what page the variable was > > initially created on. > > > > FYI: use unset($_SESSION['SESSION_UNAME']); to erase a session variable. > > > > ---John Holmes... - -- ~Paul Nicholson Design Specialist @ WebPower Design "The web....the way you want it!" [EMAIL PROTECTED] "It said uses Windows 98 or better, so I loaded Linux!" Registered Linux User #183202 using Register Linux System # 81891 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9rhvkDyXNIUN3+UQRAivwAKCcBNJ1hfZU7WFfGaCythFfPPpZOQCePte1 3xJtk0cmbfr1g6wOQnqOYMk= =jou+ -----END PGP SIGNATURE----- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php