Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

session nightmare

Status
Not open for further replies.

joeisbatman

Programmer
Oct 8, 2001
39
US
The php manual has conflicting data on this issue, and I keep hearing different things from everyone.

I have one variable that I need to be constantly updated. Using session variables how can I keep this variable updated? I find that a if I do-
session_start();
$foo =5;
session_register('foo);
------------------------
Then on another page
------------------------
session_start();
$foo = $foo + 5;
echo $foo;

The result is 10. If I keep hitting refresh on this page the number will continue to go up. HOwever once i leave this page, the # returns to 5. Let me quote a post in the PHP docs:
====================================================
Re: changing registered variables.

registered session vars cannot be changed by the user. I.e. typing in

will not cause the "$valid_user" var, which we have previously
registered,
to be overwritten with the value "true".
You can change the value of registered vars in your script. I.e. coding

if ($thisguyisvalid) {
$valid_user = 'true';
}
will work. The $valid_user var will continue to be set at true for the
session, or until you explicitly change it again.
=========================================================
So can anyone clear this up?
 
Dude fellas, sorry ignore this post. I just jumped out of bed to discover that this post doesn't make coherent sense (too tired maybe?). Of course my variable wasn't going to change cuz I kept resetting it back to 5. Solving this simple example isn't near helping me with my larger problem. Oh well, until I can figure out my question-- Thanks anyway.




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top