Hi all,
hope you can help
I have an xml document that is loading nicely into a database, with the exception of the images within the image tags. See structure of xml below
<channel>
<property>
<name>Name here</name>
<description>​Description here etc etc</description>
<images>
<img id="0">img url 1 here </img>
<img id="1">img url 2 here </img>
</images>
</property>
</channel>
I would like to get the image url's into the database with the | to separate them if possible.
Below is the php script I am using get the info from xml into database.
It works well for all fields except the images as they are id's with the main image tag
<?php
include('conn.php');
if(!$xml=simplexml_load_file('test1.xml')){
trigger_error('Error reading XML file',E_USER_ERROR);
}
foreach ($xml as $syn)
{
$name = $syn->name;
$description = $syn->description;
$images = $syn->img[];
$sql = "INSERT INTO Benek
(
name,
description,
images
)
VALUES
(
'$name',
'$description',
'$images'
)";
$query = mysql_query($sql);
if (!$query)
{
echo ('Error: ' . mysql_error());
}
else
{
echo "Record added";
}
}
?>
Thanks for your time.
Paul