When I run the following code [which is my 1st attempt at creating XML from
a mysql database, eventualy this will become an RSS feed] I get the follwing
error and cant really see the problem I am incxluding this file from another
page
thanks in advance

Wayne...

ERROR I GET: [if I run from test.php]
----------------


Only one top level element is allowed in an XML doent. Error processing
resource 'http://localhost/index.php'. Line 2, Position 2

<br />
-^


-------------------
ERROR [if I run directly - meaning this is probably the problem area]
-------------------


Only one top level element is allowed in an XML doent. Error processing
resource 'http://localhost/test.php'. Line 3, Position 2

<b>Warning</b>: Cannot modify header information - headers already sent by
(output started at c:\inetpub\wwwroot\test.php:2) in
<b>c:\inetpub\wwwroot\test.php</b> on line <b>4</b><br />
-^


------------------
CODE [test.php]
-------------------


<?php
header("Content-type: text/xml");

$host = "localhost";
$user = "root";
$pass = "******";
$database = "rssdb";

$linkID = mysql_connect($host, $user, $pass) or die("Could not connect to
host.");
mysql_select_db($database, $linkID) or die("Could not find database.");

$query = "SELECT * FROM myarticles ORDER BY date DESC";
$resultID = mysql_query($query, $linkID) or die("Data not found.");

$xml_output = "<?xml version=\"1.0\"?>\n";
$xml_output .= "<entries>\n";

for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
$row = mysql_fetch_assoc($resultID);
$xml_output .= "\t<entry>\n";
$xml_output .= "\t\t<date>" . $row['date'] . "</date>\n";
// Escaping illegal characters
$row['content'] = str_replace("&", "&", $row['content']);
$row['content'] = str_replace("<", "<", $row['content']);
$row['content'] = str_replace(">", "&gt;", $row['content']);
$row['content'] = str_replace("\"", "&quot;", $row['content']);
$xml_output .= "\t\t<content>" . $row['content'] . "</content>\n";
$xml_output .= "\t</entry>\n";
}

$xml_output .= "</entries>";

echo $xml_output;

?>