0
I’m having trouble displaying the information in a simple table in html, I’m trying everything, the php code is this:
<?php
$header = true;
echo '<html><body><table><meta http-equiv="Content-Type"
content="text/html";
charset="iso-8859-1">';
if ($header){
foreach ($obg->conteudo->coluna as $col => $valor){
echo'<th>'.htmlentities( $valor ).'</th>';
}
$header=false;
}
echo '</table></body></html>';
?>
The variable $obg = simplexml_load_string(uma variavel com xml string);
, that is, she is an object.
The error is as follows:
PHP Notice: Trying to get Property of non-object
What’s the error line? On the foreach line? If that’s the case, probably $obg->content is not an object
– David Alves
It’s right on Echo
– Froslass
Makes a
var_dump($obg);
before the foreach to see what kind of object is.– Sam
Object(Simplexmlelement)
– Froslass