seanj43 Posted October 28, 2010 Share Posted October 28, 2010 Is there a way to reset a session? Here is my code... <?php session_start(); if (!isset($_SESSION['logged_in'])) { header("Location: login.php"); } mysql_connect("localhost", "user", "password")or die("cannot connect"); mysql_select_db("database")or die("cannot select DB"); $bio = $_POST['Bio']; $location = $_POST['Location']; $username = $_SESSION["user_name"]; $sql = "UPDATE users SET bio = '$bio', location = '$location' WHERE username = '$username'"; $result = mysql_query($sql) or die ("Error in query: $sql. " . mysql_error()); ?> Now I have a session called bio that I need to reset so that it will store the new bio information. How can I do this? I tried to unset the session and start it again but this didn't work. Quote Link to comment https://forums.phpfreaks.com/topic/217151-session-reset/ Share on other sites More sharing options...
akitchin Posted October 28, 2010 Share Posted October 28, 2010 it's tough to answer your question, since we have no idea how your session is currently structured or how/where you set the original $_SESSION values. could you not simply use: $_SESSION['bio'] = $bio; to rewrite with the new $bio information? you don't necessarily have to "reset" the session, you can simply overwrite the current variables with the new information. Quote Link to comment https://forums.phpfreaks.com/topic/217151-session-reset/#findComment-1127781 Share on other sites More sharing options...
seanj43 Posted October 28, 2010 Author Share Posted October 28, 2010 Sorry stupid question. It worked. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/217151-session-reset/#findComment-1127783 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.