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.

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.