Re: session prob
| From: | Geoff O'Callaghan | Date: | Tue, 06 May 2003 09:52:23 +0000 |
| Subject: | Re: session prob | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-146498@lists.php.net to get a copy of this message | ||
On Tue, 2003-05-06 at 07:38, Steve Keller wrote:
> At 5/5/2003 08:02 AM, Geoff O'Callaghan wrote:
>
> > <?php
> > session_start();
> > session_register('count');
> > $count++;
> > print "You have been to this web page $count times<p>";
> > ?>
>
> According to the script you've posted, you're never putting the session
> count into $count, and never putting $count back into the session data. You
> seem to be assuming that $_SESSION['count'] and $count are the same
> variable, they are not, and incrementing $counter does not affect the
> session variable. What you should be doing is grabbing the session value
> into a new variable, incrementing it, and then putting it back.
>
Steve, thanks.... that's just the slap with a fish that I needed. I'm
guessing that somewhere between 'antique land' php4.0.6 and 4.2.2+ ;
session variables were no longer automatically registered as global
variables. I should get out more :-)
Anyway, thank you very much.
Cheers
Geoff