I'm new to php
, and I came across the following problem.
I have a function that returns 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 several different information, eg:
$nomeJoao = $teste[1].nome;
print_r($nomeJoao);
I get the following error on 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