Jump to content

xml file to print to help in html table data.


turk182

Recommended Posts

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++;

        }
        }
}

?>

01.png

----------------------------------------------------
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>' ;
        }
    }
}

02.png

----------------------------------------
If the support I rejoice.(Sorry for bad english)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.