Re: Session updates ok first time only.

From: Date: Wed, 30 Jan 2002 02:25:35 +0000
Subject: Re: Session updates ok first time only.
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-82643@lists.php.net to get a copy of this message
On Tue, 29 Jan 2002 12:11:02 +0800, you wrote: >On Tuesday 29 January 2002 06:36, Floyd Baker wrote: > >> Yes I have a c:\tmp directory and I see the session being created in >> it. And the page_view value of 1 after the first increment. The >> editor wants to reload each time I hit the submit button after that >> but the value does not increase beyond 1. It is also the same session >> each time. No new sessions are being created. >> >> I have turned on the log and keep getting undefined_variables for >> those two lines in each page that call $page_view before it's >> incremented, unless I am engaging the $_SESSION call. Then >> $table_view becomes 1 and there are no errors. But the incremented >> value doesn't hold up. >> >> Almost like nothing is happening.., except the *editor* thinks there >> is something going on when looking at the session file?? Like a one >> is being loaded each time. How could that be? Or the original one is >> staying even though an overwrite is being attempted. > >Here's an interesting snippet from the manual: > >The track_vars and register_globals configuration settings influence how the >session variables get stored and restored. > >Note: As of PHP 4.0.3, track_vars is > always turned on. > >If track_vars is enabled and register_globals is disabled, only members of >the global associative array $HTTP_SESSION_VARS can be registered as session >variables. The restored session variables will only be available in the array > $HTTP_SESSION_VARS. > >Try the simple example in the manual: > ><?php >session_register("count"); >$_SESSION["count"]++; >echo "Count is " . $_SESSION["count"]; >?> > >> Now I have uploaded these scripts to my isp and they do not work up >> there either. That is, using his ini, his php 4.0 with >> register_globals on, etc. Could you perhaps test these scripts on >> your machine or create an 'accumulating' routine of your own that >> works? So I can see where the difference might be coming in? > >Your original scripts with the changes I suggested works on my system. This is what I am seeing now using your code above. The increment works when done directly into the session register but when done on the page, it does not get applied. I am incrementing both ways in succession and reloading. These are the results I get on each reload. Register Page 1 1-2 2 2-3 3 3-4 4 4-5 or similar. Any changes done outside the register just do not get recorded into the register. They must be done in the register itself. Many thanks again Jason. That was a good one. I am off and looking for the next problem now. Floyd --

« previous php.general (#82643) next »