0

Hello I want to send xml values to a database I just created, here is the xml file


<record>
<name>tcpmux</name>
<protocol>tcp</protocol>
<xref type="person" data="Mark_Lottor"/>
<description>TCP Port Service Multiplexer</description>
<number>1</number>
</record>
<record>
<name>tcpmux</name>
<protocol>udp</protocol>
<xref type="person" data="Mark_Lottor"/>
<description>TCP Port Service Multiplexer</description>
<number>1</number>
</record>

I've got 4 columns in my database:- ServiceName, PortNumber, TransportProtocol and Description and I need to send the name, protocol, description and number of each record to my database. I'm new to XML so your help will be highly appreciated.


I was able to print the data onto my screen for viewing.

<?php

$xml = simplexml_load_file('C:\view-source www.iana.org assignments service-names-port-numbers service-names-port-numbers.xml')
or die("Could Not Open The TEXT File<hr /> ");

foreach($xml->children() as $child)
{
foreach($child->children() as $young)
{
echo $young->getName() . ": " . $young . "<br />";
}

echo "<br />";

}

Now all I need is to send the records to MySQL.
Thanks in advance!!!

2
Contributors
1
Reply
4
Views
5 Years
Discussion Span
Last Post by Stefano Mtangoo
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.