FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » simple session question
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
simple session question [message #175694] Fri, 21 October 2011 17:49
cerr is currently offline  cerr
Messages: 33
Registered: September 2010
Karma:
Member
Hi There,

I'm a session newbie and got a (probably) simple question:
I have belowcode and i would expect stp to count up from 1 to 3 then
back to 1 when ever I reload this page but it for some reason always
stays at 0. Why that?

Thank you for assistance!

My code:

if(!isset($_SESSION['stp'])) {
session_start();
$_SESSION['stp'] = 0;
echo "session started<br>\n";
}
switch($_SESSION['stp']) {
case 0: $_SESSION['stp'] = $_SESSION['stp']++;
echo "stp:".$_SESSION['stp'];
break;
case 1: $_SESSION['stp'] = $_SESSION['stp']++;
echo "stp:".$_SESSION['stp'];
break;
case 2: $_SESSION['stp'] = $_SESSION['stp']++;
echo "stp:".$_SESSION['stp'];
$_SESSION['stp'] = 0;
break;
[Message index]
 
Read Message
Previous Topic: Queuing at job from within php program?
Next Topic: Import values reading from XML nodes
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 00:46:07 GMT 2024

Total time taken to generate the page: 0.04174 seconds