Insert data into mysql php in diffrent rows after retrieve from xml file

azngrl111593

New Member
test.xml\[code\]<?xml version="1.0" encoding="ISO-8859-1"?><propertyList> <business type="food"> <listingAgent id="1"> <name>Spiro Abelas</name> <email>[email protected]</email> </listingAgent> </business> <business type="food"> <listingAgent id="2"> <name>andy</name> <email>[email protected]</email> </listingAgent> </business></propertyList>\[/code\]Php code Interprets an XML file into an object \[code\]<?php if (file_exists('test.xml')) { $xml = simplexml_load_file('test.xml'); echo "<pre>"; print_r($xml); echo "</pre>"; } else { exit('Failed to open test.xml.'); } ?>\[/code\]Output \[code\] SimpleXMLElement Object([business] => Array([0] => SimpleXMLElement Object( [@attributes] => Array ( [type] => food ) [listingAgent] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 1 ) [name] => spiro => [email protected] ))[1] => SimpleXMLElement Object( [@attributes] => Array ( [type] => food ) [listingAgent] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 2 ) [name] => andy [email] => [email protected] ))))\[/code\][b]Table structure[/b] [img]http://i.stack.imgur.com/HFqh0.jpg[/img][b]i want to inset data like that into table[/b][img]http://i.stack.imgur.com/BhPFc.jpg[/img]but i not getting how to retrieve data from array and insert into multiple rowsso plz guide me how to sort out it
 
Back
Top