I am working with codeigniter ona PHP project at the moment, and one the libraries I am using returns an object of database results, that looks like this,
stdClass Object
(
[user_id] => 2
[firstname] => John
[surname] => Doe
[email] => [email protected]
[password] => 9d210a03bed920971fefab01b8f84a27
[postcode] => W1 5ST
[date_registered] => 2021-04-11 10:56:47
[last_logged_in] => 2011-05-04 11:56:03
[user_type_id] => 2
)
I am then trying to echo the values using the follow code, I sending user to my view by doing the following,
$data['users'] = $this->users_model->get_by($this->session->userdata('user_id');
$this->load->view('view', $data);
Then in my view I am doing the following,
echo $users->firstname;
However I get the following error at the top of my page,
A PHP Error was encountered
Severity: 4096
Message: Object of class stdClass could not be converted to string
Filename: libraries/Parser.php
Line Number: 63
How can I resolve this? Without changing how the database results are returned ideally.
usersyet accessinguser. Is that a typo?