chocopi Posted May 27, 2007 Share Posted May 27, 2007 How do you destroy a specific session without damaging the others: <?php $id = $_SESSION['id']; $username = $_SESSION['username']; $password = $_SESSION['password']; ?> How could i just destroy $id = $_SESSION['id']; ? Thanks, ~ Chocopi Quote Link to comment https://forums.phpfreaks.com/topic/53165-solved-destroy-a-specific-session/ Share on other sites More sharing options...
trq Posted May 27, 2007 Share Posted May 27, 2007 You can set it to an empty string. $_SESSION['id'] = ''; Quote Link to comment https://forums.phpfreaks.com/topic/53165-solved-destroy-a-specific-session/#findComment-262639 Share on other sites More sharing options...
Diego17 Posted May 27, 2007 Share Posted May 27, 2007 By "destroy a specific session" you mean "destroy one session variable"? There is an example in the online docs http://www.php.net/manual/en/ref.session.php Example 2163. Unregistering a variable with $_SESSION and register_globals disabled. <?php session_start(); // Use $HTTP_SESSION_VARS with PHP 4.0.6 or less unset($_SESSION['count']); ?> Quote Link to comment https://forums.phpfreaks.com/topic/53165-solved-destroy-a-specific-session/#findComment-262641 Share on other sites More sharing options...
chocopi Posted May 27, 2007 Author Share Posted May 27, 2007 Cheers Diego and thorpe Im going to use Diego's as im using along with if(!isset($_SESSION['blah'])); Thanks, ~ Chocopi Quote Link to comment https://forums.phpfreaks.com/topic/53165-solved-destroy-a-specific-session/#findComment-262645 Share on other sites More sharing options...
shiloh2 Posted August 8, 2009 Share Posted August 8, 2009 thank you.. it works unset($_SESSION['sessname']); Quote Link to comment https://forums.phpfreaks.com/topic/53165-solved-destroy-a-specific-session/#findComment-893454 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.