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 #175695] Fri, 21 October 2011 17:44 Go to previous message
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
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: session cookie: client side
Next Topic: by get this format my explode file name like this through php
Goto Forum:
  

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

Current Time: Thu Nov 07 20:04:22 GMT 2024

Total time taken to generate the page: 0.04308 seconds