Forum Moderators: coopster
databas name:testing
table: rss
The code which I m trying is:
<? header('Content-type: text/xml');?>
<?php
$con= mysql_connect('localhost','root','') or die('Unable to connect');
$db=mysql_select_db('testing') or die('unable to connect database');
?>
<rss version="2.0">
<channel>
<title>Name of your site</title>
<description>A description of your site</description>
<link>http://your_home_page_url/</link>
<copyright>Your copyright information</copyright>
<?
$getItems="SELECT id,title,body,UNIX_TIMESTAMP(datepub) AS pubDate from rss ORDER BY pubDate DESC";
$doGet=mysql_query($getItems);
while($item=mysql_fetch_array('$doGet'))
{
$id=$doGet['id'];
$title=strip_tags($doGet['title']);
$body=strip_tags($doGet['body']);
$body=substr($doGet['body'],0,150);
$pubDate=strftime("%a, %d %b %Y %T %Z",$doGet['pubDate']);
// output to browser
?>
<item>
<title><?php print htmlentities($title,'ENT_QUOTES');?></title>
<description><?php print htmlentities($body,'ENT_QUOTES');?></description>
<link>http://your_url/path/and_page.php?article=<?php print $id;?></link>
<pubDate><?php print $pubDate;?></pubDate>
</item>
<?
}
?>
</channel>
</rss>
The error generated is:
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
End tag 'channel' does not match the start tag 'br'. Error processing resource 'http://localhost/rss/index.php'. Line 12, ...
</channel>
--^
Kindly do help me out...