CodeIgniter Forums
SOLVED this was posted twice for some reason see other post - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: SOLVED this was posted twice for some reason see other post (/showthread.php?tid=51924)



SOLVED this was posted twice for some reason see other post - El Forum - 05-23-2012

[eluser]the_unforgiven[/eluser]
Hi all,

I'm having major problems getting the data from from userdata even thought when i print_r the array i get this which clearly states the id is set:

Code:
Array ( [session_id] => f29e9f7a9facc6b8742e56a01446295d [ip_address] => 0.0.0.0 [user_agent] => Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:12.0) Gecko/20100101 Firefox/12.0 [last_activity] => 1337785533 [user_data] => [username] => test [is_user] => 1 [last_login] => 1337783842 [customer_id] => Array ( [id] => 14 [acc_number] => 172102 [ip_address] => 0

Basically i want to grab the id when each user is logged in and each user will have a different id obviously, but need to grab it from the session then store in a variable to use then within my controller: like so:

Code:
$data['cust_id'] = $this->session->userdata('id'); to pass to view or do whatever with

Also i this model i just want to get the id associted with the username thats been logged in , how does one achive such thing?