I'm trying to write a RSS feed which will pull info from a mySQL DB. In order
for the server
to read the XML file as PHP, I've uploaded a .htaccess file to my server with
this code in it:
AddType application/x-httpd-php .php .xml
Then, my feed looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>FlyRope.com News</title>
<description>News feed for Flyrope.com.</description>
<link>http://www.flyrope.com/feed.xml</link>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<lastBuildDate>Fri, 14 Jul 2006 20:48:19 -0500</lastBuildDate>
<pubDate>Fri, 14 Jul 2006 20:46:13 -0500</pubDate>
<?
mysql_connect('localhost', 'xx', 'xx');
mysql_select_db('xx');
$newsquery = "SELECT *, UNIX_TIMESTAMP(timeposted) AS pubdate
FROM news
ORDER BY timeposted desc
LIMIT 25";
$newsresult = mysql_query($newsquery) or die(mysql_error());
while ($news = mysql_fetch_array($newsresult))
{
?>
<item>
<title><?=htmlentities(strip_tags($news['headline'])); ?></title>
<description><?=htmlentities(strip_tags($news['article'],'ENT_QUOTES'));?></
description>
<link>http://www.flyrope.com/sections/current/newsfull.php?var=<?=$news
['newsid'];?></link>
<pubDate><?=strftime( "%a, %d %b %Y %T %Z" , $news['pubdate']);
?></pubDate>
</item>
<?
}
?>
</channel>
<xml/>
Has anyone successfully done this? And, is my code correct?
------------------------ Yahoo! Groups Sponsor --------------------~-->
See what's inside the new Yahoo! Groups email.
http://us.click.yahoo.com/2pRQfA/bOaOAA/yQLSAA/HKFolB/TM
--------------------------------------------------------------------~->
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php-list/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/