<?xml version="1.0" encoding="utf-8"?>
    <rss version="2.0">
    <channel>
    <title>Eastern College</title>
    <link>http://ec.edu.my</link>
    <description>A feed for articles on web development</description>
    <language>en-us</language>
    <copyright>2009 Eastern College</copyright>
    <managingEditor>kolej-eastern@ec.edu.my</managingEditor>
    <webMaster>kolej-eastern@ec.edu.my</webMaster>
    <pubDate>Tue, 10 Jan 2012 15:41:45 EDT</pubDate>
    <lastBuildDate>Tue, 10 Jan 2012 15:41:45 EDT</lastBuildDate>
    <category>Web Development</category>
    <generator>Eastern College RSS Feed</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>60</ttl>
    <image>
    <url>http://ec.edu.my/images/icon/rss news.png</url>
    <title>Eastern College</title>
    <link>http://ec.edu.my/index.php</link>
    <height>95</height>
    <width>133</width>
    <description>A web development resource center</description>
    </image>
    <?php
    //Connect to the database here
    require_once('connect.php');
    //Create the SELECT statement and execute it
    $query = "SELECT *, DATE_FORMAT(article_date, '%a, %d %b %Y %T PST') AS article_pubdate FROM articles ORDER BY article_date LIMIT 5";
    $result = mysql_query($query);
    //Iterate over the rows to create each item
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC) {
    echo '<item>
    <title>'.$row['article_title'].'</title>
    <link>'.$row['article_url'].'</link>
    <description>'.$row['article_text'].'</description>
    <author>'.$row['article_author'].'</author>
    <category>'.$row['article_category'].'</category>
    <pubDate>'.$row['article_pubdate'].'</pubDate>
    <source url="http://ec.edu.my/index.php">Eastern College</source>
    </item>
    }
    ?>
    </channel>
    </rss>
