RSS Feed any MySQL Database using PHP

To some folks rss is this hot new technology that is changing our lives in technology. The truth is rss is a specific formated text file that people finally have standarized on. It’s the standarization that changes people lives, not neccessary the technology. Anyway, a while back I wanted to rss feed our knowledgebase. The knowledgebase articles are stored in a mysql database. I played around with using PEAR::PACKAGE::XML to do the job but found it to be a bit overkill. So I wrote my own xml builder – source code is below or you can download the php rss feed mysql database code. What is nice, is that you can RSS feed any database.




Your RSS Title Goes HERE http://www.yourlinkgoeshere.com Describe your RSS Feed Heredescription>
en-us
http://backend.userland.com/rss
PHP/$phpversion


http://www.yoursite.com/images/YourLogo.gif http://www.yoursite.com/index.php 140
60
Describe Your Image

END;

// loop through the array pulling database fields for each item
for ($i = 0; $i < mysql_num_rows($result1); $i++) { @$row = mysql_fetch_array($result1); $title = cleanText($row["question"]); $link = "http://www.YourSite.com/kb/index.php?article=".$row["id"]; $description = $row["mycontent"]; //Replace Ugly HTML that got into the Knowledgebase with nothing $desc_replace = array("

 

", "

 

", );
$desc_replace_with = array("", "", "");
$desc_temp = str_replace($desc_replace, $desc_replace_with, $description);

//Now clean the HTML
$mydescription = cleanText($desc_temp);
$pubDate = $row["date"];

// display an item
ECHO <<
$title $link $mydescription... For the entire article, please visit our site. $pubDate


END;

}

ECHO <<

END;

?>

Tim

A .NET, PHP, Marketing Guru authority, at least I hope I am. Reach me at tboland@gmail.com

7 thoughts on “RSS Feed any MySQL Database using PHP

  1. i am working with news site. i want rss feed that have the latest vedio news. how to store the rss feed my control pannel please tell me

  2. Hello there folks,
    I am a website specialist attempting to expand my perspectives by learning PHP and mySQL.I have been learning mySQL for a couple of months now by taking after instructional exercises and so on and have a significant decent comprehension of the arrangement now. I have onto adding a mySQL database to my site utilizing PHP (I am still at the beginning phases of learning PHP).

  3. really such an impressive and knowledgeable post, RSS solves a problem for people who regularly use the web. It allows you to easily stay informed by retrieving the latest content from the sites you are interested in. You save time by not needing to visit each site individually. and I love to use the RSS but recently I have to face some difficulties in my web project but after your post it really the reason for my solution.
    Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *