RSS with PHP and MySQL

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


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-05-2006
Laeronai
 
Posts: n/a
Default RSS with PHP and MySQL

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?

Reply With Quote
  #2 (permalink)  
Old 03-05-2006
Janwillem Borleffs
 
Posts: n/a
Default Re: RSS with PHP and MySQL

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



Reply With Quote
  #3 (permalink)  
Old 03-05-2006
Gale
 
Posts: n/a
Default Re: RSS with PHP and MySQL

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
Reply With Quote
  #4 (permalink)  
Old 03-06-2006
Laeronai
 
Posts: n/a
Default Re: RSS with PHP and MySQL

I know it's uppercase, but the "c" key on my keyboard broke. I copied
and pasted a lowercase "c" just for ease of posting, but when I code I
copy and paste an uppercase "c." I need to get it fixed. Laptop
keyboards are a pain.

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 12:17 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0