please read carefully and i appreciate for your help and answers so my code is getting data from xml and show but its works just on my categories.xml not on my products.xml
this is my categories.xml structure
<?xml version="1.0"?>
<categories>
<category>
<categories_name>name</categories_name>
<sort_order>order number</sort_order>
</category>
<category>
<categories_name>name</categories_name>
<sort_order>order number</sort_order>
</category>
</categories>
and the code i used
<?php
$xml=simplexml_load_file("categories.xml") or die("Error: Cannot create object");
foreach ($xml->children() as $category): ?>
<div class="product">
<img src="<?= $category->categories_name; ?>"><br>
<?= $category->sort_order; ?>
</div>
<?php endforeach; ?>
and its working perfectly
but when i tried this code on my products.xml its show blank here is my products.xml
<TABLE-RECORDS>
<EXPORT-RECORDS>
<PRODUCT>
<PRODUCTS_NAME>name </PRODUCTS_NAME>
<PRODUCTS_DESCRIPTION>details</PRODUCTS_DESCRIPTION>
<PRODUCTS_IMAGE>number</PRODUCTS_IMAGE>
<PRODUCTS_PRICE>$</PRODUCTS_PRICE>
</PRODUCT>
<PRODUCT>
<PRODUCTS_NAME>name </PRODUCTS_NAME>
<PRODUCTS_DESCRIPTION>details</PRODUCTS_DESCRIPTION>
<PRODUCTS_IMAGE>number</PRODUCTS_IMAGE>
<PRODUCTS_PRICE>$</PRODUCTS_PRICE>
</PRODUCT>
</EXPORT-RECORDS>
</TABLE-RECORDS>
and here is the php code for fetching
<?php $xml=simplexml_load_file("products.xml") or die("Error: Cannot create object");
foreach ($xml->children() as $product): ?>
<div class="product">
<?= $product->PRODUCTS_NAME; ?>
</div>
i think i'm getting error on TABLE-RECORDS i check many times but i didn't fetch any thing ... it show me blank page
waiting for your reply
No comments:
Post a Comment