Page 1 of 1
session variables
Posted: Sat Jul 20, 2002 1:33 pm
by Zmodem
Code: Select all
<?php
session_start();
if (!isset($_SESSIONї'count']))
{
$_SESSIONї'count'] = 0;
}
else
{
$_SESSIONї'count']++;
}
echo $_SESSIONї'count'];
?>
The above code was copied and posted into a php document straight from the PHP manual. It does not work on my machine for some reason.
$count is always 0. 0 is always echoed.
I am currently running win2k, php 4.1, apache 1.3.24
I have also tried $HTTP_SESSION_VARS on PHP 4.0.6 and that still did not work.
It does however, work fine if I just use globals (session_register("count");) etc etc.
I can't figure this out. Its beyond me. Perhaps I've missed something simple. ANyone have any ideas for me?
Thanks guys
Posted: Sat Jul 20, 2002 1:44 pm
by jason
Posted: Mon Jul 22, 2002 11:34 am
by Zmodem
Hmmm, odd.
Without changing the script, I upgraded from PHP 4.1.0 to 4.1.2. Still didn't work.
Then I upgraded to 4.2.0 and voila! works great!
Not sure what to think about that. I've never been one to scream "BUG!!"..... but.....
Posted: Mon Jul 22, 2002 11:39 am
by fatalcure
hum, how long do session variables last anyway?
Posted: Mon Jul 22, 2002 11:49 am
by RandomEngy
I think until you close the browser window or the session is destroyed or the variables are manually unset.
Posted: Mon Jul 22, 2002 12:21 pm
by fatalcure
well yea, i thought it was till you closed the browser, but going to Jason's test scipt:
http://www.phpcomplete.com/test.php , it seems to still be counting up from last time since i've closed my browser.
Just curious, i've never used sessions before.