I created a dynamic rss code using php and mysql. I created the code and everything looks in order. However, I am not getting any results in the rss page except the header.
Please find the code below
<?php
$host = "localhost"; // host name
$user = "";
$pass = "";
$database = "";
// connecting to database
$connect = @mysql_connect($host,$user,$pass)or die (@mysql_error());
// selecting database
@mysql_select_db($database,$connect) or die (@mysql_error());
// default header
header("Content-Type: text/xml;charset=utf-8");
echo '<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title></title>
<description></description>
<link></link>';
// mytable = my content table name
$query = @mysql_query('
SELECT * FROM mt_news LIMIT 0,15 ORDER BY addeddate DESC');
while($row = @mysql_fetch_array($query)){
$id=$row['news_id'];
$title=strip_tags($row['news_title']);
$body=strip_tags($row['news_description']);
$body=substr($row['news_description'],0,150);
// output to client
?>
<item>
<title><?print htmlentities($title,’ENT_QUOTES’);?></title>
<description><?print htmlentities($body,’ENT_QUOTES’);?></description>
<link>"http://".$_SERVER['HTTP_HOST']."/newsd-".$row['sef_link'];</link>
<pubDate> <?=strftime( "%a, %d %b %Y %T %Z" , $row['addeddate']); ?></pubDate>
</item>
<? } ?>
</channel>
</rss>
Appreciate your assistance