xml file to php table -


i create simple xml file , , try tu print result in php table reason dont work paste xml , php code maybe body can help;

xml:

<?xml version="1.0" encoding="utf-8" standalone="no" ?> <root>     <ciezarowe>         <bova>             <futura_fhd10>                 <id>au-1080</id>                 <sy>09.2001</sy>                 <ey>nie okteslil idota</ey>                 <wva>29087 29042</wva>                 <id2>au-1080</id2>                 <wva2>29087 29042</wva2>             </futura_fhd10>         </bova>     </ciezarowe> 

and php code:

<?php     $get = file_get_contents('aaa.xml');     $arr = simplexml_load_string($get);     $data = $arr -> root ; ?> <table>     <tr>         <th>przod</th>         <th>rok produkcji</th>         <th>koniec produkcji</th>         <th>wva</th>         <th>tyl</th>         <th>wva2</th>     </tr>     <?php         foreach($data $row) {     ?>     <tr>         <td><?php echo $row->id ?></td>         <td><?php echo $row->sy ?></td>         <td><?php echo $row->ey ?></td>         <td><?php echo $row->wva ?></td>         <td><?php echo $row->id2 ?></td>         <td><?php echo $row->wva2 ?></td>     </tr>     <?php         }     ?> 

you xml not valid because root tag not closed.

if can't change code, generating xml, add close tag string. , code work

$arr = simplexml_load_string($get . '</root>'); 

and change line

$data = $arr->ciezarowe->bova->futura_fhd10; 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -