CubeRock Posted January 16, 2015 Share Posted January 16, 2015 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 UPRICE1 IV001 01/01/2015 100.00 A1 Balloon 1 30.002 IV001 01/01/2015 100.00 A2 Bag 2 20.003 IV001 01/01/2015 100.00 A3 Pen 3 10.004 IV002 02/01/2015 20.00 A3 Pen 2 10.005 IV003 02/01/2015 50.00 A1 Balloon 1 30.006 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.