0
I would like to access the direct key of an array object without having to loop (foreach)
Instead of being like this:
$nome = "";
$codigo = 0;
$objeto = DB::select( "SELECT NOME FROM TABELA WHERE CODIGO = ?", array( $codigo ) );
foreach ( $objeto as $obj ){
$nome = $obj->nome;
}
echo $nome;
I wish I didn’t need foreach
Type
$nome = $objeto->nome;
But give the following message:
Trying to get Property of non-object
Blz. Thank you very much, already helped me a lot and already saved some lines of code rsrs
– adventistaam