This is a discussion on RSS with PHP and MySQL within the PHP Language forums, part of the PHP Programming Forums category; Say that I have a table in my MySQL database that holds all the RSS information for my blog posts. ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Say that I have a table in my MySQL database that holds all the RSS
information for my blog posts. I have link, title, and description. could I make an RSS feed with PHP code in it, or would that not just be possible? I was thinking along the lines of: while ($rssinfo = mysql_fetch_array($query, mysql_assoc)) { echo '<item><title>' . $rssinfo['title'] . '</title><description>' . $rssinfo['description'] . '</description><link>' . $rssinfo['link'] . '</link</item>'; } I would put this in feed.xml or something like that, which would hold all the feed information. Would this code work, or would I have to use some other method? |
|
|||
|
Laeronai wrote:
> I would put this in feed.xml or something like that, which would hold > all the feed information. Would this code work, or would I have to use > some other method? > As a rough outline, it will work, but keep the following in mind: * Generating a static file, which is refreshed once in a while might be a good idea; * Follow the specifications (http://web.resource.org/rss/1.0/spec). And, on a side note: * PHP constants are case-sensitive (it's not mysql_assoc, but MYSQL_ASSOC). JW |
|
|||
|
Laeronai wrote:
> Say that I have a table in my MySQL database that holds all the RSS > information for my blog posts. I have link, title, and description. > could I make an RSS feed with PHP code in it, or would that not just be > possible? I was thinking along the lines of: > > while ($rssinfo = mysql_fetch_array($query, mysql_assoc)) { > echo '<item><title>' . $rssinfo['title'] . '</title><description>' . > $rssinfo['description'] . '</description><link>' . $rssinfo['link'] . > '</link</item>'; > } > > I would put this in feed.xml or something like that, which would hold > all the feed information. Would this code work, or would I have to use > some other method? > http://codewalkers.com/seecode/607.html |