Jump to content

How can I show the data detail in PHP from MYSQL


CubeRock

Recommended Posts

Hi all expert. I am a newbie in this PHP programming. I need your help or advise on the PHP. And question is, I have a list of data and the details are as below:

ID  BILLNO   DATE        AMOUNT   ITEM   DESCRIPTION   QTY   UPRICE
1   IV001   01/01/2015   100.00   A1     Balloon        1    30.00
2   IV001   01/01/2015   100.00   A2         Bag        2    20.00
3   IV001   01/01/2015   100.00   A3         Pen        3    10.00
4   IV002   02/01/2015    20.00   A3         Pen        2    10.00
5   IV003   02/01/2015    50.00   A1     Balloon        1    30.00
6   IV003   02/01/2015    50.00   A2         Bag        1    20.00

 

 

How can I make the output in xml by using PHP to output as below:

<RECORD>
  <HEADER BILLNO="IV001" DATE="01/01/2015" AMOUNT="100.00>
    <DETAIL ITEM="A1" DESCRIPTION="Balloon" QTY="1" UPRICE="30.00">
    </DETAIL>
    <DETAIL ITEM="A2" DESCRIPTION="Bag" QTY="2" UPRICE="20.00">
    </DETAIL>
    <DETAIL ITEM="A3" DESCRIPTION="Pen" QTY="3" UPRICE="10.00">
    </DETAIL>
  </HEADER>
  <HEADER BILLNO="IV002" DATE="02/01/2015" AMOUNT="20.00>
    <DETAIL ITEM="A3" DESCRIPTION="Balloon" QTY="2" UPRICE="10.00">
    </DETAIL>
  </HEADER>
</RECORD>

 

 

Your feedback is highly appreciated. Thank you.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.