Output mySQL data as XML with PHP tut

Hi All, i hope someone can help me.

Ive been doing the tutorial and when i run my php script it shows up like this

Andersson Munoz Andrew Yiannoullou Antony Luxton Chris Rhodes Craig Sherrin Dean Sherrin James Clarke James Woods Kristian Fulljames Lee Beetles Lee Gilchrist Lee Sherrin Luke Millard Mark Peermamode Matt Lasky Matt Lowman Michael Groves Paul Clarke Ricky Hipgrave Ross Hefford Steve Lewy Stuart Rook

but when i click on view source it shows like this

<?xml version="1.0" encoding="iso-8859-1"?>
<entries>
<player>
<name>Andersson Munoz</name>
<text></text>
</player>
<player>
<name>Andrew Yiannoullou</name>
<text></text>
</player>
<player>
<name>Antony Luxton</name>
<text></text>
</player>
<player>
<name>Chris Rhodes</name>
<text></text>
</player>
<player>
<name>Craig Sherrin</name>
<text></text>
</player>
<player>
<name>Dean Sherrin</name>
<text></text>
</player>
<player>
<name>James Clarke</name>
<text></text>
</player>
<player>
<name>James Woods</name>
<text></text>
</player>
<player>
<name>Kristian Fulljames</name>
<text></text>
</player>
<player>
<name>Lee Beetles</name>
<text></text>
</player>
<player>
<name>Lee Gilchrist</name>
<text></text>
</player>
<player>
<name>Lee Sherrin</name>
<text></text>
</player>
<player>
<name>Luke Millard</name>
<text></text>
</player>
<player>
<name>Mark Peermamode</name>
<text></text>
</player>
<player>
<name>Matt Lasky</name>
<text></text>
</player>
<player>
<name>Matt Lowman</name>
<text></text>
</player>
<player>
<name>Michael Groves</name>
<text></text>
</player>
<player>
<name>Paul Clarke</name>
<text></text>
</player>
<player>
<name>Ricky Hipgrave</name>
<text></text>
</player>
<player>
<name>Ross Hefford</name>
<text></text>
</player>
<player>
<name>Steve Lewy</name>
<text></text>
</player>
<player>
<name>Stuart Rook</name>
<text></text>
</player>
</entries>

Should my php file be showing like the view source???

This is my php file

<?
header("Content-type: text/xml");
$host = "localhost";
$user = "****";		  // Username
$pass = "****";			  // Password
$database = "football";	  // Database name
$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 players ORDER BY name";
$result = mysql_query($query, $linkID) or die("Data not found.");

$xml_output = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>
";
$xml_output .= "<entries>
";
 for ($x = 0; $x < mysql_num_rows($result) ; $x++){
  $row = mysql_fetch_assoc($result);
  $xml_output .= "	<player>
";
  $xml_output .= "		<name>" . $row['name'] . "</name>
";
  $xml_output .= "		<pos>" . $row['pos'] . "</pos>
";
  $xml_output .= "		<dob>" . $row['dob'] . "</dob>
";
  $xml_output .= "		<apps>" . $row['apps'] . "</apps>
";
   // Escaping illegal charcters
   $row ['text'] = str_replace("&", "&", $row['text']);
   $row ['text'] = str_replace("<", "&lt", $row['text']);
   $row ['text'] = str_replace(">", "&gt", $row['text']);
   $row ['text'] = str_replace("\"", "&quote", $row['text']);
  $xml_output .= "		<text>" . $row['text'] . "</text>
";
  $xml_output .= "	</player>
";
 }
 $xml_output .= "</entries>";
 print $xml_output;
?>

example of what i had… working.


$result = mysql_query($query) or die (mysql_error()); 
$num = mysql_num_rows($result); 


$file= fopen("resulta.xml", "w"); 
$_xml ="<?xml version=\"1.0\" encoding=\"UTF-8\"?>
"; 
$_xml .="<cardat>
"; 
if(mysql_num_rows($result) > 0){ 
while($rows = mysql_fetch_array($result)) 
   {
	  //$_xml .="	<dato=\"" . $rows["dato"] . "\">
";$_xml .="	</dato>
"; 
	  $_xml .="<envctrol>
";
      $_xml .="	<tipo-operador>08";$_xml .="	</tipo-operador>
"; 
      $_xml .="	<codigo-operador> 5519";$_xml .="	</codigo-operador>
"; 
	  $_xml .="	<nume-regist-cabe>1";$_xml .="	</nume-regist-cabe>
"; 
	  $_xml .="	<nume-regist-cabe-dav>1";$_xml .="	</nume-regist-cabe-dav>
"; 
      $_xml .="	<nume-regist-doc-transp>1";$_xml .="	</nume-regist-doc-transp>
"; 
      $_xml .="	<t-fob-doc-transp>20";$_xml .="	</t-fob-doc-transp>
"; 
      $_xml .="	<t-peso-bruto-manifdo>20";$_xml .="	</t-peso-bruto-manifdo>
"; 
      $_xml .="	<clave-electronica>5519";$_xml .="	</clave-electronica>
"; 
      $_xml .="	<nume-regist-items>1";$_xml .="	</nume-regist-items>
"; 
      $_xml .="	<nume-doc-id>17905466667001";$_xml .="	</nume-doc-id>
"; 
	  $_xml .="	</envctrol>
";
#like 400 more of these

	  $_xml .="	</mandet02>
";	  
	  $_xml .="	</mandet01>
";
	  $_xml .="	</manhdr01>
";
     
      
      }
	  }
      else 
         { 
         $_xml .="	<Query_Empty>=\"No Resulta\">
"; 
         $_xml .="	</Query_Empty>
"; 
         } 
		 
         $_xml .="</cardat>"; 
         fwrite($file, $_xml); 
         fclose($file); 
         echo "XML formato list.  <a href=\"resulta.xml\">Por Aqui el formato XML.</a>"; 

?>