homepage Welcome to WebmasterWorld Guest from 54.204.94.228
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / RSS, ATOM, and Related Technologies
Forum Library, Charter, Moderators: bill & werty

RSS, ATOM, and Related Technologies Forum

    
Dynamic updation of rss with php-mysql
need help for Dynamic updation of rss with php and mysql
web007




msg:1542486
 9:47 am on Mar 19, 2005 (gmt 0)

I m trying create rss feed which is database driven.
i have taken help of online documents. It is generating errors when seen in browser or RSS Aggregator.

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...

 

eurotrash




msg:1542487
 12:05 am on Mar 20, 2005 (gmt 0)

Not sure if any good php jockeys visit this forum a lot. If you don't get an answer in here soon I would suggest trying the same post over in the php [webmasterworld.com] forum.

Sorry I can't be more helpful.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / RSS, ATOM, and Related Technologies
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved