Results 1 to 3 of 3

Thread: [RESOLVED] XML to MySql Using PHP

Threaded View

  1. #1
    Join Date
    Feb 2012

    resolved [RESOLVED] XML to MySql Using PHP


    I have been trying to find a way to export data from an xml document and back into mysql. i have wrote the following code:

    PHP Code:
    $oDOM = new DOMDocument();
    foreach (
    $oDOM->getElementsByTagName('conferences') as $Conferences1)



    $sql "insert into `Conferences` (`Event`, `Subject`) values ('$Event', '$Subject')";
    $perform_insert mysql_query($sql) or die("<b>Data could not be entered</b>.\n<br />Query: " $query "<br />\nError: (" mysql_errno() . ") " mysql_error()) 
    The above code works perfectly if the xml is set in a different layout to what i want, this is the layout that works:

    <Event>More Time</Event>

    the layout i need to use is the following:

    <Subject value="134142832" />
    <Event VALUE="More Time" />

    I've been stuck on this for a while now and wonder if anyone could help please?

    In the XML document theirs is about 300 separate XML's all looking like the above and all will need to be imported.

    Hope this makes sense.

    Many Thanks
    Last edited by thewebportfolio; 03-13-2012 at 04:41 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center