I wrote this for you.
Hope it works.
<?PHP
define( 'LF', "\n" );
function utf8Encode( $str )
{
return utf8_encode( htmlspecialchars( $str ) );
}
mysql_connect( 'localhost', 'user', 'pass' );
mysql_select_db( 'database' );
$tmp = '<?xml version="1.0" encoding="utf-8" ?>' . LF;
$tmp .= '<rss version="2.0">' . LF;
$tmp .= '<channel>' . LF;
$query = mysql_query( "SELECT * FROM news ORDER BY id DESC LIMIT 10" );
while( $myrow = mysql_fetch_assoc( $query ) )
{
$tmp .= '<item>' . LF;
$tmp .= '<title>' . utf8Encode( $myrow['title'] ) . '</title>' . LF;
$tmp .= '<link>http://www.yoururl.com/news.php?id=' . $myrow['id'] . '</link>' . LF;
$tmp .= '<news>' . utf8Encode( $myrow['news'] ) . '</news>' . LF;
$tmp .= '<author>' . utf8Encode( $myrow['author'] ) . '</author>' . LF;
$tmp .= '</item>' . LF;
}
$tmp .= '</channel>' . LF;
$tmp .= '</rss>' . LF;
if( !( $fp = fopen( 'doc.xml', 'w+' ) ) )
die( 'Couldnt open RSS file for writing.' );
if( !fwrite( $fp, $tmp ) )
die( 'Couldnt write to RSS file.' );
?>