I have this array in PHP and should display the users name and email field. However, php displays an error message:
array(4)
{
[0]=> object(stdClass)#25 (5)
{
["idusuario"]=> string(1) "2"
["nome"]=> string(5) "admin"
["email"]=> string(15) "[email protected]"
["senha"]=> string(3) "123"
["status"]=> string(1) "1"
}
[1]=> object(stdClass)#26 (5)
{
["idusuario"]=> string(1) "3"
["nome"]=> string(5) "teste"
["email"]=> string(15) "[email protected]"
["senha"]=> string(3) "123"
["status"]=> string(1) "0"
}
}
PHP code
<?php
echo $dados["0"]["nome"];
echo $dados["1"]['email'];
?>
Error message:
A PHP Error was encountered
Severity: Notice
Message: Undefined index: name
Filename: home / list.php
Line Number: 20
Backtrace
:
A PHP Error was encountered
Severity: Notice
Message: Undefined index: email
Filename: home / list.php
Line Number: 21