-1

I have this xml file:

<test time="11.11.2011 11:11" >
<field type="one" value="10"/>
<field type="two" value="10"/>
</test>

and I would like to echo in php and save into DB each 15 mins (type, value). I have cron. So the site'll look like this:

Type: one | Value: 10
Type: two | Value: 10
Time: 11.11.2011 11:11

and after 15 mins:

Type: one | Value: 10
Type: two | Value: 10
Time: 11.11.2011 11:11
Type: one | Value: 10
Type: two | Value: 10
Time: 11.11.2011 11:26

I can't find the right way to write the code, so i'm asking for your help. Thank you ;)

Miso
  • 49
  • 6
  • possible duplicate of [A simple program to CRUD node and node values of xml file](http://stackoverflow.com/questions/4906073/a-simple-program-to-crud-node-and-node-values-of-xml-file) – Gordon May 22 '11 at 09:40
  • @Gordon, that's a duplicate of the XML handling but not saving to DB (it shows saving back to XML). – John Carter May 22 '11 at 11:27
  • @there This is really two problems asked here. One is reading the XML. The other is how to insert data into Db. Both have been answered before. Pick one of http://stackoverflow.com/search?q=hot+so+insert+data+sql+php for the DB insertion. With the OP not even showing any of his attempts to get this working, I am assuming this is just another lazy gimme-teh-codez question. – Gordon May 22 '11 at 11:42

2 Answers2

1

Try out SimpleXML: http://de2.php.net/manual/en/book.simplexml.php

reeaal
  • 347
  • 3
  • 14
  • 2
    [How do I write a good answer to a question](http://meta.stackexchange.com/questions/7656/how-do-i-write-a-good-answer-to-a-question) – Gordon May 23 '11 at 07:08
0

You have to use the XML Parser. More info: http://www.php.net/manual/en/example.xml-structure.php

Eduard7
  • 725
  • 7
  • 19
  • 2
    [How do I write a good answer to a question](http://meta.stackexchange.com/questions/7656/how-do-i-write-a-good-answer-to-a-question) – Gordon May 23 '11 at 07:08