hi all,
i am having some trouble with entering my data into a database table
i have loaded a rss feed and have managed to pull out the specific elements from it and i have echo'd them out to check that they are correct which they are, but for some reason it doesnt like my varibles
here is my code
it adds the $i and the storeName but nothing else?
any ideas where im going wrong, please
thanks
Luke
i am having some trouble with entering my data into a database table
i have loaded a rss feed and have managed to pull out the specific elements from it and i have echo'd them out to check that they are correct which they are, but for some reason it doesnt like my varibles
here is my code
PHP Code:
$xml=("http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topsongs/sf=143444/limit=10/explicit=true/xml?partnerId=2003&TD_PARAM=http://clkuk.tradedoubler.com/click?p=23708&a=1515427&url=");
$xmlDoc = new DOMDocument();
$xmlDoc->load($xml);
for ($i = 0; $i < 10; $i++) {
//get elements from "<channel>"
$channel=$xmlDoc->getElementsByTagName('entry')->item($i);
$channel_title = $channel->getElementsByTagName('title')->item(0)->childNodes->item(0)->nodeValue;
$channel_image = str_replace("30x30-50","100x100-75",$channel->getElementsByTagName('image')->item(0)->childNodes->item(0)->nodeValue);
$channel_link = $channel->getElementsByTagName('id')->item(0)->childNodes->item(0)->nodeValue;
$channel_album = $channel->getElementsByTagName('name')->item(0)->childNodes->item(0)->nodeValue;
$channel_artist = $channel->getElementsByTagName('artist')->item(0)->childNodes->item(0)->nodeValue;
$channel_cost = $channel->getElementsByTagName('price')->item(0)->childNodes->item(0)->nodeValue;
$sql = "INSERT INTO product_database (pID,store,productTitle) VALUES ($i,'itunes',$channel_title)";
$query = mysql_query($sql);
//output elements from "<channel>"
echo ("<a href='$channel_link'>".$channel_title."</a>");
echo("<br />");
echo $channel_album;
echo("<br />");
echo $channel_artist;
echo("<br />");
echo $channel_cost;
echo("<br />");
echo ("<img src='$channel_image'>");
echo("<br />");
}
?>
any ideas where im going wrong, please
thanks
Luke
Comment