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
Re: simple session question [message #175710 is a reply to message #175705] Sat, 22 October 2011 13:50 Go to previous messageGo to previous message
Thomas Mlynarczyk is currently offline  Thomas Mlynarczyk
Messages: 131
Registered: September 2010
Karma:
Senior Member
cerr schrieb:
>> session_start();
>> if ( !isset( $_SESSION['stp'] ) )
>> {
>> $_SESSION['stp'] = 0;
>> echo "session started<br>\n";
>>
>> }
>>
>> echo $_SESSION['stp'];
>> $_SESSION['stp'] = ( $_SESSION['stp'] + 1 ) % 3;

> Hi Thomas,
>
> Thanks for the reply! Using your code, the variable always stays 0
> too, it doesn't change ever. I always see "
> session_start(); session started
> 0" printed, seems like it may not know sessions, is that possible at
> all?

The only way I can see for this to happen is if you have the <?php
*after* the session_start() line, like this:

session_start();
<?php
if ( !isset( $_SESSION['stp'] ) ) // ...

If you have it as it should be --

<?php
session_start();
if ( !isset( $_SESSION['stp'] ) ) // ...

-- then there would be no way for "session_start()" to appear in the
output. If the counter then still remains at 0, you may have cookies
disabled in your browser.


Greetings,
Thomas

--
Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!
(Coluche)
[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 28 14:35:32 GMT 2024

Total time taken to generate the page: 0.04882 seconds