I am new to codeIgniter, I have a query in my model as
return $query = $this->db->get('users')->result();
and I have passed the result from controller to view as
$data['users'] = $this->admin_login->get_users();
But I am not able to print the passed data properly in my view, because it is in standard class object.
So far I have tried
foreach ($users as $user)
{
print_r $user;
}
and the result I am getting is
stdClass Object
(
[user_id] => 1
[user_name] => mujju
[email] => [email protected]
[mobile] => 9021444578
)
stdClass Object
(
[user_id] => 2
[user_name] => mujahed
[email] => [email protected]
[mobile] => 8989898989
)
stdClass Object
(
[user_id] => 3
[user_name] => akas
[email] => [email protected]
[mobile] => 6545789878
)
stdClass Object
(
[user_id] => 4
[user_name] => sayyed
[email] => [email protected]
[mobile] => 654597879686
)
and what I am expecting is to use something like $user['user_id'] , $user['user_name'] etc. in foreach loop.