<?php
header("Content-Type: application/rss+xml;");
if(!@include("config.php")){
	die("<h1>Error:cannot get to config.php</h1>");
}

if(!@include("connection.php")){
	die("<h1>Error:cannot get to connection.php</h1>");
}

$sql = "SELECT * FROM $table ORDER BY date desc";
$result = mysql_query($sql,$connection);

echo '<?xml version="1.0" encoding="iso-8859-1"?>';
echo '<rss version="2.0">';
echo '<channel>';
echo '<title>A2Z Decor Latest News</title>';
echo '<description>Xplore the latest news of the leading IT company A2Z Egypt</description>';
echo '<link>http://www.a2zegypt.com/news.php</link>';

while($row = mysql_fetch_array($result)){
					$id = $row['id'];
					$date = $row['date'];
					$title = $row['title'];
					$news_head = substr($row['news_head'],0,50);
					$news_body = $row['news_body'];
					
					echo "<item>
					<title>$date: $title</title>
					<description>$news_head...</description>
					<link>http://www.a2zegypt.com/news.php?id=$id</link>
					</item>";
	}
	
echo '</channel>';
echo '</rss>';
?>