Welcome Guest, Not a member yet? Register   Sign In
Retrive data from session.
#1

I getting NULL Registration id from session.

But when i check
Code:
var_dump( $this->session->userdata['logged_in']);die;

Result:
array (size=3)
 'registration_id ' => string '1' (length=1)
 'email' => string '[email protected]' (length=20)
 'name' => string 'Ahmed' (length=12)

When i am getting registration id from session, its null

Code:
$registration_id = $this->session->userdata['logged_in']['registration_id'];
var_dump($registration_id);die;

Result:
null

Help me out Thanks.
Web Developer
Reply
#2

That is very strange. Is there anything happening between the two var_dumps besides assigning value to $registration_id? Try something like this and see what happens.
PHP Code:
$registration_id $this->session->userdata['logged_in']['registration_id'];
var_dump($this->session->userdata['logged_in']['registration_id']);
var_dump($registration_id);
die; 

I'm stumped if you still get NULL. If you don't get NULL, it probably means you are accidentally modifying the session data somewhere before assigning the value to $registration_id.
Hey, don't work without a PHP debugger. Several free IDEs have this features built in. Two are NetBeans and CodeLobster. Without a debugger, it's like you're driving with a blindfold on -- you are going to crash!
Reply
#3

(This post was last modified: 03-11-2015, 06:21 AM by Php.)

(03-11-2015, 06:07 AM)RobertSF Wrote: That is very strange. Is there anything happening between the two var_dumps besides assigning value to $registration_id? Try something like this and see what happens.


PHP Code:
$registration_id $this->session->userdata['logged_in']['registration_id'];
var_dump($this->session->userdata['logged_in']['registration_id']);
var_dump($registration_id);
die; 

I'm stumped if you still get NULL. If you don't get NULL, it probably means you are accidentally modifying the session data somewhere before assigning the value to $registration_id.

I got my error Here:
Result:
array (size=3)
'registration_id ' => string '1' (length=1)
'email' => string '[email protected]' (length=20)
'name' => string 'Ahmed' (length=12)

1st line after registration_id and before single inverted comma containing a wide space. Tongue
AND i am using netbeans.
Thanks.
Web Developer
Reply
#4

(This post was last modified: 03-11-2015, 11:01 AM by RobertSF.)

Glad you found it! I didn't notice that at first either. Smile
Hey, don't work without a PHP debugger. Several free IDEs have this features built in. Two are NetBeans and CodeLobster. Without a debugger, it's like you're driving with a blindfold on -- you are going to crash!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB