0
I’m a beginner in php
, and I came across the next problem.
I have a function that returns me an array that comes from the database.
$teste = dados($conexao);
And I do:
print_r($teste);
It returns me the following data:
Array (
[0] => Array (
[nome] => Maria
[idade] => 26
)
[1] => Array (
[nome] => Joao
[idade] => 18
)
)
Now comes the problem, I want to add one of the information in several different, ex:
$nomeJoao = $teste[1].nome;
print_r($nomeJoao);
I get the following error on the screen:
Warning: Use of Undefined Constant name - assumed 'name' (this will throw an Error in a Future version of PHP)
Notice: Array to string Conversion
$nomeJoao = $teste[1]['nome'];
Resolves ?– Pedro Augusto