我有一个带有标题和描述的项目的 RSS 提要。我想将这些加载到表中
我有类似的东西,但它既没有回显任何东西,也没有插入任何东西。
$con = mysql_connect("localhost","USERNAME","PASSWORD");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$rss = simplexml_load_file('rss.xml');
foreach ($rss->item as $eachFilm) {
$film_name = array($eachFilm->title);
$film_release = array($eachFilm->description);
echo $film_name;
mysql_query("INSERT INTO Films (Film_Name, Film_Release)
VALUES ('$film_name', '$film_release')");
}
mysql_close($con);
任何帮助将非常感激!
编辑 - 示例 RSS -
</image><item>
<title>Remembrance</title>
<link>http://www.filmdates.co.uk/films/3950-remembrance/</link>
<description><![CDATA[Release Date: Wednesday 18th April 2012]]></description>
<category>Movie</category>
<pubDate>Tue, 27 March 2012 20:31:29 MST</pubDate>
</item><item>
<title>In Search of Haydn</title>
<link>http://www.filmdates.co.uk/films/3672-in-search-of-haydn/</link>
<description><![CDATA[Release Date: Thursday 19th April 2012]]></description>
<category>Movie</category>
<pubDate>Mon, 16 April 2012 19:33:41 MST</pubDate>
</item><item>