Connecting Tech Pros Worldwide Help | Site Map

RSS with PHP and MySQL

 
LinkBack Thread Tools Search this Thread
  #1  
Old March 5th, 2006, 03:15 PM
Laeronai
Guest
 
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?


  #2  
Old March 5th, 2006, 09:45 PM
Janwillem Borleffs
Guest
 
Posts: n/a
Default Re: RSS with PHP and MySQL

Laeronai wrote:[color=blue]
> 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?
>[/color]

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



  #3  
Old March 5th, 2006, 10:05 PM
Gale
Guest
 
Posts: n/a
Default Re: RSS with PHP and MySQL

Laeronai wrote:[color=blue]
> 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?
>[/color]

http://codewalkers.com/seecode/607.html
  #4  
Old March 6th, 2006, 03:05 AM
Laeronai
Guest
 
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.

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.