|
Posted by mysitesucks@gmail.com on 11/18/06 11:42
when i display them they all show up, its only the last one of those
that are displayed that will be inserted into the mysql database
here is te code
<?php
require_once '../Content/rss_fetch.inc';
$url = 'http://www.usatoday.com/repurposing/NBARss.xml' ;
$rss = fetch_rss($url);
echo 'Site: ' , $rss->channel['title'], ' <br / >';
if ( $rss and !$rss->ERROR) {
foreach ($rss->items as $item ) {
echo ' <p><a href="' . $item[link] . '">' . $item[title] . '
</a><br / >';
echo 'Publish Date: ' . $item[pubdate] . ' <br / >';
echo $item[ description ] . ' </p>' ;
}
} else {
echo 'RSS Error: ' . $rss->ERROR . ' <br / ><br />' ;
}
include("connect.php");
//Item Info
$Added=date(Ymd);
$Item_Title=$item[title];
$Item_Link=$item[link];
$Item_Category=$item[category];
$Item_PubDate=$item[pubdate];
$Item_Description=$item[description];
$add = "INSERT INTO Articles VALUES (NULL, '$Item_Title',
'$Item_Category', '$SubCategory', '$Added',
'$Item_PubDate','$Item_Link', '$Item_Description')";
$result=mysql_query("$add");
mysql_close($connection);
?>
Navigation:
[Reply to this message]
|