ayok Posted March 15, 2009 Share Posted March 15, 2009 Hi, I have a question about session_destroy(). For example I have some sessions like: <?php $_SESSION['language'] == "english"; $_SESSION['name'] == "john"; $_SESSION['cart'] == "1"; $_SESSION['password'] == "admin123"; ?> And somehow I want to change only the $_SESSION['language'] into "dutch", for example, and keep the value of the others. How can I do that? Everythime I create session_destroy(), it destroys all the sessions. Any helps? Thank you. ayok Link to comment https://forums.phpfreaks.com/topic/149508-destroy-one-of-the-sessions/ Share on other sites More sharing options...
Mikedean Posted March 15, 2009 Share Posted March 15, 2009 Firstly, when setting variables you need to use only 1 equal sign, 2 are used for conditional (if) statements. If you only want to change the value and not delete it, all you would need to do is: $_SESSION['language'] = "dutch"; If you do want to delete it. unset( $_SESSION['language'] ); Link to comment https://forums.phpfreaks.com/topic/149508-destroy-one-of-the-sessions/#findComment-785163 Share on other sites More sharing options...
ayok Posted March 15, 2009 Author Share Posted March 15, 2009 Yup! thanks a lot! Link to comment https://forums.phpfreaks.com/topic/149508-destroy-one-of-the-sessions/#findComment-785201 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.