Welcome Guest, Not a member yet? Register   Sign In
Help session grab user_id from database
#1

[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
Code:
function getCustomer()
{
   $data = array();
   $options = array('id' => 14);
   $Q = $this->db->get_where('users',$options,1);
   if ($Q->num_rows() > 0){
        $data = $Q->row_array();
   }
     $Q->free_result();    
     return $data;
}
i just want to get the id associted with the username thats been logged in , how does one achive such thing?


Messages In This Thread
Help session grab user_id from database - by El Forum - 05-23-2012, 08:16 AM
Help session grab user_id from database - by El Forum - 05-23-2012, 08:36 AM
Help session grab user_id from database - by El Forum - 05-23-2012, 08:40 AM
Help session grab user_id from database - by El Forum - 05-23-2012, 08:43 AM
Help session grab user_id from database - by El Forum - 05-23-2012, 08:45 AM
Help session grab user_id from database - by El Forum - 05-23-2012, 08:52 AM
Help session grab user_id from database - by El Forum - 05-23-2012, 08:56 AM
Help session grab user_id from database - by El Forum - 05-23-2012, 08:58 AM
Help session grab user_id from database - by El Forum - 05-23-2012, 09:01 AM
Help session grab user_id from database - by El Forum - 05-23-2012, 09:06 AM
Help session grab user_id from database - by El Forum - 05-23-2012, 09:07 AM
Help session grab user_id from database - by El Forum - 05-23-2012, 09:13 AM
Help session grab user_id from database - by El Forum - 05-23-2012, 09:15 AM
Help session grab user_id from database - by El Forum - 05-23-2012, 09:20 AM
Help session grab user_id from database - by El Forum - 05-23-2012, 09:21 AM
Help session grab user_id from database - by El Forum - 05-23-2012, 10:19 AM
Help session grab user_id from database - by El Forum - 05-23-2012, 10:22 AM
Help session grab user_id from database - by El Forum - 05-23-2012, 10:25 AM
Help session grab user_id from database - by El Forum - 05-23-2012, 10:29 AM
Help session grab user_id from database - by El Forum - 05-23-2012, 10:30 AM
Help session grab user_id from database - by El Forum - 05-23-2012, 10:37 AM
Help session grab user_id from database - by El Forum - 05-23-2012, 10:42 AM
Help session grab user_id from database - by El Forum - 05-23-2012, 11:07 AM
Help session grab user_id from database - by El Forum - 05-23-2012, 12:42 PM
Help session grab user_id from database - by El Forum - 05-24-2012, 08:50 AM
Help session grab user_id from database - by El Forum - 05-24-2012, 09:06 AM
Help session grab user_id from database - by El Forum - 05-24-2012, 09:16 AM
Help session grab user_id from database - by El Forum - 05-24-2012, 09:35 AM
Help session grab user_id from database - by El Forum - 05-24-2012, 09:37 AM
Help session grab user_id from database - by El Forum - 05-24-2012, 10:30 AM
Help session grab user_id from database - by El Forum - 05-24-2012, 10:41 AM
Help session grab user_id from database - by El Forum - 05-25-2012, 08:57 AM
Help session grab user_id from database - by El Forum - 05-25-2012, 08:12 PM
Help session grab user_id from database - by El Forum - 05-25-2012, 08:29 PM
Help session grab user_id from database - by El Forum - 05-26-2012, 12:35 AM
Help session grab user_id from database - by El Forum - 05-26-2012, 03:01 AM
Help session grab user_id from database - by El Forum - 05-26-2012, 03:37 AM
Help session grab user_id from database - by El Forum - 05-26-2012, 09:03 AM
Help session grab user_id from database - by El Forum - 05-26-2012, 11:35 AM
Help session grab user_id from database - by El Forum - 05-28-2012, 01:35 AM
Help session grab user_id from database - by El Forum - 05-28-2012, 03:13 AM
Help session grab user_id from database - by El Forum - 05-29-2012, 04:40 AM
Help session grab user_id from database - by El Forum - 05-29-2012, 07:56 AM
Help session grab user_id from database - by El Forum - 05-29-2012, 09:52 AM
Help session grab user_id from database - by El Forum - 05-29-2012, 09:54 AM
Help session grab user_id from database - by El Forum - 05-29-2012, 11:37 AM
Help session grab user_id from database - by El Forum - 05-29-2012, 12:57 PM
Help session grab user_id from database - by El Forum - 06-09-2012, 09:07 PM
Help session grab user_id from database - by El Forum - 06-11-2012, 12:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB