How to get data objects in controller |
I'm really new to this so excuse my query on something that is probably fundamental but...
I have a controller that has the model in the constructor, I have created a method in the model which grabs a record from the database. I call it in my controller like so: $data['user'] = $this->jobseekers_model->getUser($userId); Now I have checked and it is returning an array, I can see it using print_r but I can't seem to figure out how to get an array element, I am trying to set a session var using: $newdata = array( 'username' => $user['username'], 'email' => $user['email'], 'logged_in' => TRUE ); but then I get the error: Message: Undefined variable: user can anyone please advise? Do I need to loop through the array first an assign each array element to a new array? Surely not? |
Messages In This Thread |
How to get data objects in controller - by barrypoore - 04-09-2018, 05:04 AM
RE: How to get data objects in controller - by jreklund - 04-09-2018, 05:40 AM
RE: How to get data objects in controller - by barrypoore - 04-09-2018, 05:46 AM
RE: How to get data objects in controller - by jreklund - 04-09-2018, 06:47 AM
RE: How to get data objects in controller - by barrypoore - 04-09-2018, 09:08 AM
RE: How to get data objects in controller - by barrypoore - 04-09-2018, 10:01 AM
RE: How to get data objects in controller - by jreklund - 04-09-2018, 10:25 AM
RE: How to get data objects in controller - by barrypoore - 04-09-2018, 11:32 AM
|