From XML to SQL through PHP?
Posted: Thu Jun 17, 2010 1:56 pm
Ok, I am developing an Android application (Java). However, the app creates and upload a .xml file through HTTP Post and I need the data in the xml file to be added to a database. I have little experience with PHP and hoping for (a lot of) help here.
Here is an example xml file
Jeg need a .php script which will take in this XML file and put the data into the following database table:
the ID can be generated automatically (auto-increment) so no need to worry about that.
source = data source attribute in the xml file
reply = reply_to in xml file
message = message in xml file.
So wondering if anyone can help me out here?
Kind regards
Here is an example xml file
Code: Select all
<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<root>
<ushout_message />
<data source="bf882ed25e322d48" reply_to="0" />
<message>Shout out to the world</message>
</root>Code: Select all
`id` INT( 6 ) NOT NULL ,
`source` INT( 20 ) NOT NULL ,
`reply` INT( 20 ) NOT NULL ,
`message` VARCHAR(200) NOT NULL ,
PRIMARY KEY ( `id` )source = data source attribute in the xml file
reply = reply_to in xml file
message = message in xml file.
So wondering if anyone can help me out here?
Kind regards