I'm in need of retrieving individual data from a php array. This is how my array looks like:
Array (
[0] => stdClass Object (
[membername] => Moni
[memberid] => 5
[membertype] => 1
[roleid] => 1
)
)
I got this by writong this print_r($result);
This is how I tried to retrieve individual data:
$login = TableRegistry::get('login');
$result = $login->loginuser($loginid, $password);
print_r($result);
echo $result->memberid;
But, I get this error: Trying to get property of non-object [APP/Controller\LoginController.php, line 17]
This is line-17: echo $result->memberid;
So, how can I do this? How can I retrieve individual data?