Re: Session updates ok first time only.
| From: | Jason Wong | Date: | Mon, 28 Jan 2002 03:39:02 +0000 |
| Subject: | Re: Session updates ok first time only. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-82353@lists.php.net to get a copy of this message | ||
On Monday 28 January 2002 04:37, Floyd Baker wrote:
> Can someone tell me why this is not working right? Two pages are
> basically the same, passing an accumulating value back and forth.
> There is no other session being created. The first time it increments
> and passes to the second page, and is picked up. It puts a 1 in the
> session file. After that, it seems to try, as in editor wanting to
> reload, but the contents don't increase beyond 1.
>
> I have 4.1, register globals off, on Windows 98.
>
> TIA
> //pull value from session file:
> $page_views = $_SESSION['page_views'];
No need for this, in fact this is what is preventing it from working! Once
you've used session_register('var'), $var is available for use.
> print "<br>Return Page";
> print "<br>Before increment = $page_views";
>
> //increment the counter:
> $page_views++;
> $page_views++;
You're inc'ing $page_views twice, this is what makes you *think* the session
is working when in fact it isn't!
hth
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
/*
On the road, ZIPPY is a pinhead without a purpose, but never without a POINT.
*/