Developer: How to create a XML feed?

<?php
// You need to edit these variables
$siteurl="http://www.yoursitedomain.com"; //without /

$mysql_server=""; //mysql server, usually it's localhost
$mysql_user=""; //mysql user
$mysql_password=""; //mysql password
$mysql_database=""; //database name

//You don't need to edit this section
mysql_connect($mysql_server, $mysql_user,$mysql_password);
mysql_select_db($mysql_database);
mysql_query( "SET NAMES 'utf8'");

header("Content-type: text/xml");
$rssurl=$siteurl."/".basename(__FILE__);

echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?>
<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:trackback=\"http://madskills.com/public/xml/rss/module/trackback/\" xmlns:wfw=\"http://wellformedweb.org/CommentAPI/\" xmlns:slash=\"http://purl.org/rss/1.0/modules/slash/\" xmlns:atom=\"http://www.w3.org/2005/Atom\">
<channel>
<title>Game Feed For 4J.com</title> 
<link>".$siteurl."</link>
<description>Game Feed For 4J.com</description>
<language>en-us</language>
<atom:link href=\"".$rssurl."\" rel=\"self\" type=\"application/rss+xml\" />
";

//You need to change this section based on your data structure
$sql = "select * from `exclusivegames` order by `id` desc"; //
$result = mysql_query($sql,$db); 
$i=0;
while( $Tmp = mysql_fetch_array($result, MYSQL_ASSOC)){
echo "
<item>
<name>".HandleSpecialCharsForXML($Tmp["name"])."</name>
<description>".HandleSpecialCharsForXML($Tmp["description"])."</description>
<control>".HandleSpecialCharsForXML($Tmp["control"])."</control>
<type>swf</type>
<file>".$siteurl."/files/".$Tmp["id"].".swf</file>
<width>".$Tmp["width"]."</width>
<height>".$Tmp["height"]."</height>
<size>".$Tmp["size"]."</size>
</item>";
}
echo "</channel>
</rss>";

function HandleSpecialCharsForXML($str){
$str=str_replace("&","&amp;",$str);
return $str;
}
?>