Welcome Guest, Not a member yet? Register   Sign In
A little help with retriving session data
#1

[eluser]chrisls121[/eluser]
Hi I'm very new to programming in general and found PHP and Codeigniter as a great place to start.

Just cant seem to figure out how to retrieve more the one value from userdata using the session class.

Right now Ive got:

Code:
$new_invoice->created_by = $this->session->userdata(array('first_name', 'last_name'));

But all i get the following PHP error:

Quote:A PHP Error was encountered

Severity: Warning

Message: Illegal offset type in isset or empty

Filename: libraries/Session.php

Line Number: 422

Thanks,
Chris L
#2

[eluser]WanWizard[/eluser]
The userdata() method only accepts a single session variable name as a string.

I'm not entirely sure what you want to archieve here. Are you expecting an array with two values returned, or a concatenation of sorts?
#3

[eluser]chrisls121[/eluser]
[quote author="WanWizard" date="1287970607"]The userdata() method only accepts a single session variable name as a string.

I'm not entirely sure what you want to archieve here. Are you expecting an array with two values returned, or a concatenation of sorts?[/quote]

Was hoping for a concatenation of the two values for display in a view

Thanks,
Chris L
#4

[eluser]chrisls121[/eluser]
Figured it out, thanks for pointing me in the right direction WanWizard :-)

Code:
$new_invoice->created_by = ($this->session->userdata('first_name')) . " " . ($this->session->userdata('last_name'));

Chris L




Theme © iAndrew 2016 - Forum software by © MyBB