Jump to content

Session reset?


seanj43
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.