Hello David
I used this example to fill my database with lot's of $id_s["ID"] 's:
<?php
include ("connect.php");
require("MagicParser.php");
function Vullen($id_s)
{
$sql = "INSERT INTO people (teller,id) VALUES ('','".mysql_real_escape_string($id_s["ID"])."')";
mysql_query($sql);
echo "Data Inserted!";
}
$url = "http://www.people.com/promo/xml/xml_reader.php?type=4";
MagicParser_parse($url,"Vullen","xml|PEOPLE/");
?>
But for this example only the first ID is submitted to table "people". How can I loop this safely to get all available ID's into the table?
Hello Jan,
It's difficult to tell for sure without seeing the XML however i'm not sure that the format string is correct. A format string of:
xml|PEOPLE/
...is only going to return one record - the entire document. For you to get more than one record, there has to be another level to the XPATH expression, for example:
xml|RESULTS/PEOPLE/
Feel free to drop me an email with a copy of the actual XML and i'll take a look and let you know what the format string should be...
Cheers,
David.