Re: RES: Very simple session question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Using double-quotes instead of single-quotes in the code you provided should be *no* difference at all. I'm curious if there's something else going on for you. Can you provide more complete code?

Back to your original example, calling session_start() will restart a session, so only call that function once during a request, or make sure to write out the session using session_write() before calling it again.

~Ted


On 26-May-08, at 10:32 PM, John Allsopp wrote:

Thanks all, yes, it's like that, and a & b work.

The difference? I was doing

$_SESSION['index']= $myString;

instead of

$_SESSION["index"]= $myString;

Now with "s it works.

Why?

And, worryingly, I set three variables, then dump $_SESSION and it contains three variables. I think it should still contain

$_SESSION["index"]= "value";

from the a/b test.

I'm fairly certain I'm not using any session functions to clear the session .. best guess for the cause of the loss of that variable?

Cheers
J

Thiago Pojda wrote:
Hi John,

What do you mean about "another program"? Is it something like...

a.php:
<?php
session_start();
$_SESSION["index"]= "value";

echo "call b <a href=\"b.php\">here</a>";
?>

b.php:
<?php
session_start();
var_dump($_SESSION);
?>

... or something else?

Try the example above, if this does not work then you should start looking at your php.ini for session support, check if it's disabled or something.

Or maybe try using session_write_close() at the end of the scripts, they
might work (if session support is enabled).



Atenciosamente,
www.softpartech.com.br
Thiago Henrique Pojda
Desenvolvimento Web
+55 41 3033-7676
thiago.pojda@xxxxxxxxxxxxxxxxxx
Excelência em Softwares Financeiros


-----Mensagem original-----
De: John Allsopp [mailto:john@xxxxxxxxxxxxxxxxx] Enviada em: segunda-feira, 26 de maio de 2008 18:17
Para: php-general@xxxxxxxxxxxxx
Assunto:  Very simple session question

Hi

I've gone bozzeyed, so I've a simple question for you.

I open session_start() as the first thing, on each page.

I set a session variable using, for instance,
$_SESSION['ACCOUNTemail'] = $email;

The next program, when I var_dump($_SESSION), it shows an empty array.

That program does run session_start() too.

What's obviously wrong, or what's my most likely cause?

Cheers
J




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux