Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7867267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:39:57+00:00 2026-06-03T00:39:57+00:00

//this is the code that creates the array and the output follows while ($results_row

  • 0
//this is the code that creates the array and the output follows
while ($results_row = mysql_fetch_assoc($results)) {
        $returned_results[]= array(
                                    'partName'=>$results_row['partName'],
                                    'description'=>$results_row['description'],
                                    'price'=>$results_row['price']

//what is contained in the array is as follows
Array
(
[partName] => Cooler Master CM Storm Trooper Case
[description] => Armored appearance. Nicely placed handle at the top. At the front; ext
[price] => 36000
)
1

Array
(
[partName] => Cooler Master eXtreme Power Plus 500-Watt
[description] => Power Plus 500-Watt Power Supply,many SATA and peripheral connectors. 
[price] => 23000
)
1

Array
(
[partName] => Coolmax M-500B ATX Power Supply
[description] => The Coolmax M-500B ATX Power Supply has 5 SATA and 5 Peripheral, 8 pin
[price] => 20000
)

I need to write the data contained in the array variable($returned_results[]) to an xml file. After that i will display it in an xml table. But i think i can manage the latter. Could you help me with a code example. Please & Thank you!!

the xml file should conatin the array data that looks like this

<?xml version="1.0" encoding="utf-8"?>
     <results>
           <partName>Cooler Master CM Storm Trooper Case</partName>
           <description>Armored appearance. Nicely placed handle at the top. At the front; ext... </description>
           <price>36000</price>
     </results>
     <results>
            <partName>Cooler Master eXtreme Power Plus 500-Watt</partName>
            <description>Power Plus 500-Watt Power Supply,many SATA and peripheral connectors. ... </description>
             <price>23000</price>
    </results
    <results>
            <partName>Coolmax M-500B ATX Power Supply </partName>
            <description>The Coolmax M-500B ATX Power Supply has 5 SATA and 5 Peripheral, 8 pin..</description>
             <price>20000</price>
    </results>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T00:39:59+00:00Added an answer on June 3, 2026 at 12:39 am

    You can just use PHP itself (rather than echo or fwrite, etc.) to write your XML.

    ob_start();
    ?>
    <?xml version="1.0" encoding="utf-8"?>
    <?php
    while ($results_row = mysql_fetch_assoc($results)) {
    ?>
    <results>
        <partName><?php echo htmlspecialchars($results_row['partName']);?></partName>
    </results>
    <?php
    }
    
    file_put_contents('file.xml', ob_get_clean());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well ive got this code that creates a table from JSON data. If a
I have this JavaScript code that creates a table, and puts in the rows
I have this function in a Code Igniter model that creates a new video.
I have this code that creates the navigation for a slideshow. It works just
I have some code that creates a multi-dimensional array, but my result seems to
I have a PHP function that returns an array. This is the output of
I have the this code that will create excel file and work sheet then
I've created this code branch so that if the permalink settings do no match
I have this code that works in a unit test but doesn't work when
Challenge: I have this code that fails to compile. Can you figure out what's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.