...

View Full Version : how to un-register a particular session variable from a session



amirak17
01-14-2008, 03:31 PM
Hello,

i need to unergister one or more than one session variables at a certain point in the code.

I am just using plain session implementation using session_start()

the thing is session_unregister is not working the way its written on php.net:

session_unregister($_SESSION["var_name"]);

so is there any special technique i need to use.

thanks in advance.

abduraooft
01-14-2008, 03:33 PM
unset() (http://in2.php.net/unset)

CFMaBiSmAd
01-14-2008, 03:43 PM
The php.net page for session_unregister() also contains a couple of relevant pieces of information -


Note: If $_SESSION (or $HTTP_SESSION_VARS for PHP 4.0.6 or less) is used, use unset() to unregister a session variable.


If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use session_register(), session_is_registered() and session_unregister().

oesxyl
01-14-2008, 03:45 PM
the thing is session_unregister is not working the way its written on php.net:

be more specific, please.

best regards

amirak17
01-14-2008, 04:38 PM
i am using php 5.2.5

i also tried earlier:
unset($_SESSION['varname']);

oesxyl
01-14-2008, 04:53 PM
i am using php 5.2.5

i also tried earlier:
unset($_SESSION['varname']);

this is usefull, but what do you mean when you say "is not working the way its written on php.net"?

best regards

amirak17
01-14-2008, 05:03 PM
oh by that i mean the session variable as well as its value stays in the session.

CFMaBiSmAd
01-14-2008, 05:13 PM
Check your web server log for errors. Either the session is not starting so you are not really unsetting a session variable or there is a typo in the name of the variable. Your code could also be re-setting the session variable, so, posting your code would help someone to help you.

amirak17
01-15-2008, 03:17 PM
its solved now ... thanks

ahallicks
01-15-2008, 04:46 PM
Care to explain how for anyone else that has the same problem?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum