<? header('Content-type: text/xml'); ?>
<rss version="2.0">
<channel>

<?
//database info
		$host  =  "localhost";
		$login = "gjcorpadmin";
		$password = "frankenstein22";
		$base = "gjfood";

	$db = mysql_connect($host,$login,$password);
	mysql_select_db($base,$db);
?>
<? 
	$sql = "SELECT * FROM companies LIMIT 1";
	$query = mysql_query($sql) or die("Cannot query the database.<br>" . mysql_error());
	while($result = mysql_fetch_array($query)){
		$copyright = $result['copyright'];
		$title = $result['title'];
		$url = $result['url'] ;

?>
<title><?= htmlentities($result['title'])  ?> News Feed</title>
<description>News from the website of <?= htmlentities($result['title']) ?></description>
<link><?= $result['url']  ?></link>
<copyright><? echo date('Y')." ".htmlentities($result['copyright']); ?></copyright>

<?
	}

$sql = "SELECT *, DATE_FORMAT(date, '%a, %d %b %Y %T') FROM news order by date DESC LIMIT 0,15";
$query = mysql_query($sql) or die("Cannot query the database.<br>" . mysql_error());
while($result = mysql_fetch_array($query)) {
?>
                 <item> 
       				 <title><?=htmlentities(strip_tags($result['title'])); ?></title> 
					  <description> <?=htmlentities(strip_tags($result['cont'],'ENT_QUOTES'));?></description> 
					  <link><?= $url ?>/?content=news#<?=$result['newsId'];?></link>  
					  <pubDate><?= $result[4] ?> CST</pubDate> 
					  <guid isPermaLink="false"><?= $url ?>/?content=news#<?=$result['newsId'];?></guid>
				</item>
<?
}
?>
          
</channel>
</rss>