turk182 Posted March 26, 2014 Share Posted March 26, 2014 Hi, I need your help. xml file: <?xml version="1.0" encoding="utf-8"?> <ROOT> <STOKLAR> <STOK Stok_Kod="" Stok_Ad=""> <OZELLIKLER> <OZELLIK></OZELLIK> <DEGER></DEGER> <OZELLIK></OZELLIK> <DEGER></DEGER> <OZELLIK></OZELLIK> <DEGER></DEGER> <OZELLIK></OZELLIK> <DEGER></DEGER> <OZELLIK></OZELLIK> <DEGER></DEGER> <OZELLIK></OZELLIK> <DEGER></DEGER> </OZELLIKLER> </STOK> </STOKLAR> </ROOT> -------------------------------------------- This way you can print: <?php $root = simplexml_load_file("exaproperties.ashx"); foreach ($root->STOKLAR->STOK as $stok) { foreach ($stok->OZELLIKLER as $ozellikler) { for ($i=0;$i <=count($ozellikler);$i++){ echo '<table>' ; echo '<tr>' ; echo '<td ALIGN="left" VALIGN="TOP" BGCOLOR="#FFFFFF">'.$ozellikler->OZELLIK[$i].'</td>'; echo '<td ALIGN="left" VALIGN="TOP" BGCOLOR="#FFFFFF">:</td>'; echo '<td ALIGN="left" VALIGN="TOP" BGCOLOR="#FFFFFF">'.$ozellikler->DEGER[$i].'</td>'; echo '</tr>' ; echo '</table>' ; $i++; } } } ?> ---------------------------------------------------- However, only the html table is added to the database, data is not added into HTML table cells. $xmlData = simplexml_load_file($xml_directory.$this->code."/exaproperties.ashx"); foreach ($xmlData->STOKLAR->children() as $STOK) { foreach ($STOK->children() as $OZELLIKLER => $data) { for ($i=0;$i <=count($data);$i++){ $tablo = ''; $tablo.= '<table>' ; $tablo.= '<tr>' ; $tablo = '<td ALIGN="left" VALIGN="TOP" BGCOLOR="#FFFFFF">'.$data->OZELLIK[$i].'</td>'; $tablo.= '<td ALIGN="left" VALIGN="TOP" BGCOLOR="#FFFFFF">::</td>'; $tablo.= '<td ALIGN="left" VALIGN="TOP" BGCOLOR="#FFFFFF">'.$data->DEGER[$i].'</td>'; $tablo.= '</tr>' ; $tablo.= '</table>' ; } } } ---------------------------------------- If the support I rejoice.(Sorry for bad english) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.