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 Code:
<?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.
PHP Code:
$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)