Jump to content

destroy one of the sessions


ayok

Recommended Posts

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

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'] );

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.