Hi. I’m having a strange problem where I create XML with PHP, but a dot is added at the beggining that I can’t remove and makes the whole XML useless.
Here is my code:
$xml_output = "<?xml version=\"1.0\"?>
";
$xml_output .= "<table>
";
for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
$row = mysql_fetch_assoc($resultID);
$xml_output .= " <fish>
";
$xml_output .= " <email>" . $row['email'] . "</email>
";
$xml_output .= " <fishname>" . $row['fishname'] . "</fishname>
";
$xml_output .= " <name>" . $row['name'] . "</name>
";
$xml_output .= " <url>" . $row['url'] . "</url>
";
$xml_output .= " <type>" . $row['type'] . "</type>
";
$xml_output .= " <table>" . $row['table'] . "</table>
";
$xml_output .= " </fish>
";
}
$xml_output .= "</table>";
echo $xml_output;
and here is the result (the dot is in red)
[COLOR=Red].[/COLOR]<?xml version="1.0"?>
<table>
<fish>
<email>[email protected]</email>
<fishname>Pinky</fishname>
<name>Ivan Vendrov</name>
<url>www.doom.com</url>
<type>shark</type>
<table>0</table>
</fish>
<fish>
<email>[email protected]</email>
<fishname>Finky</fishname>
<name>Ivan Bendrov</name>
<url>www.caught.com</url>
<type>dolphin</type>
<table>0</table>
</fish>
</table>