Welcome Guest, Not a member yet? Register   Sign In
weird sessions problem
#1

[eluser]AtlantixMedia[/eluser]
Hello,

I would really appreciate if someone could help me out with this:

I have a table where I store error messages which are then retrieved by a function, stored in a session cookie, and retrieved once again by the controller for showing.

Code:
$url = 'whatever';
$Msg = $AdminMsg[$code]['AdminMsg_Msg'];    
$Tmr = $AdminMsg[$code]['AdminMsg_Timer'];

$str = $Msg . '|' . $Tmr . '|' . $url;
$CI->session->set_userdata('msg', $str);

now for some messages, this works perfectly. for others, it doesn't, meaning the $str is not successfully stored by set_userdata. for example, the msg

"Your optional info has been changed.<br />
You will now be redirected to your account page"

is among those that don't work when it gets assigned to $Msg directly from the db table array. However, if I do this:

Code:
$Msg = "Your optional info has been changed.<br />
You will now be redirected to your account page";

it works perfectly. can someone shed some light on this? I'm totally lost. thanks
#2

[eluser]Peter Ivanov[/eluser]
Hi there,

maybe your session has bee cleaned up.

read this one it might help you

http://www.captain.at/howto-php-sessions.php
#3

[eluser]AtlantixMedia[/eluser]
hello,

thanks for your reply. not sure if that's the case though. as I said, it WORKS if I put the message contents inside a local variable as opposed to getting them from the db. then again, it doesn't work only with some messages
#4

[eluser]AtlantixMedia[/eluser]
any other idea? thanks
#5

[eluser]sandwormusmc[/eluser]
So what happens when you:
Code:
print_r($AdminMsg[$code]['AdminMsg_Msg']);

Also, shouldn't the following have a $this-> preceding the CI?
Code:
$CI->session->set_userdata('msg', $str);
#6

[eluser]AtlantixMedia[/eluser]
[quote author="sandwormusmc" date="1199412108"]So what happens when you:
Code:
print_r($AdminMsg[$code]['AdminMsg_Msg']);
[/quote]

the message gets printed ok

[quote author="sandwormusmc" date="1199412108"]
Also, shouldn't the following have a $this-> preceding the CI?
Code:
$CI->session->set_userdata('msg', $str);
[/quote]

the function is in a helper file. that is the reason $CI is used instead of $this

again, this works with most messages, but not all




Theme © iAndrew 2016 - Forum software by © MyBB