0

Create and Save XML file Using MySQL Data in PHP

This tutorial will help you to get data from MySQL database table and create an xml of it. Xml data can be simple to maintain and quite easy to integrate with flash environment.

In this article i’ll explain you how to execute Mysql query and format the data into an XML than save it on server.

List of steps to create and save an xml from mysql table data.

Step 1: Declare the header content type as text/xml

header(‘Content-Type: text/xml; charset=utf-8’);

Step 2: Make an Database connection.

Step 3: Write the xml code to create data as xml.

After execute this code, you will get the response as xml format and data will save on your server as save.xml file.

Note :- If you are using an http url as string in xml data with & symbol in between. It will give an error to string can not be parsed. Use & instead of & symbol in xml data.

Using above steps you can easily create an save an xml from Mysql data.

Harish

I am professional web developer and blogger. Use this blog to share own api and other web development experience with you. I do accept paid work. Write to me to start working on your dream project - codefixup@gmail.com

Leave a Reply

Your email address will not be published. Required fields are marked *