gazalec Posted March 9, 2007 Share Posted March 9, 2007 Hi this is going to sound really dumb but how to you set a session variable, i know you can use $_SESSION['variable'];, and i have read about session_register and session_unregister my problem is that at present i am using $_SESSION['variable']; but i dont know how to clear/destroy this because when a Customer enters the website they can login or enter as a guest and if they enter as a guest they can login later, the only problem is when i go to the login later the $_SESSION['variable']; is registered as Guest still so i need to clear this and then reassign them with their customer number Thanks in advance Link to comment https://forums.phpfreaks.com/topic/41953-session-variables/ Share on other sites More sharing options...
JasonLewis Posted March 9, 2007 Share Posted March 9, 2007 session_destroy() sounds like what your looking for. Link to comment https://forums.phpfreaks.com/topic/41953-session-variables/#findComment-203389 Share on other sites More sharing options...
gazalec Posted March 9, 2007 Author Share Posted March 9, 2007 apparently that only ends the session but doesn't destroy the information held i tried it but nothing Link to comment https://forums.phpfreaks.com/topic/41953-session-variables/#findComment-203394 Share on other sites More sharing options...
JasonLewis Posted March 9, 2007 Share Posted March 9, 2007 you can just reset the session to something else, i believe. <?php session_start(); $_SESSION['foo'] = "bar"; echo $_SESSION['foo']."<br>"; //echos bar $_SESSION['foo'] = "too"; echo $_SESSION['foo']; //echos too ?> but session_destroy clears all data. quote from the php manual: session_destroy -- Destroys all data registered to a session Link to comment https://forums.phpfreaks.com/topic/41953-session-variables/#findComment-203401 Share on other sites More sharing options...
gazalec Posted March 9, 2007 Author Share Posted March 9, 2007 yeah i know i thought that too but it says something about before you do you have to either unregister (PHP 4) or unset Link to comment https://forums.phpfreaks.com/topic/41953-session-variables/#findComment-203403 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.