Php and xml

I used the php code from the PHP and XML tutorial to connect to mysql and generate an xml file. The xml file is output without a problem. My actionsscript starts parsing the xml file (its a 75K xml file) but it doesnt parse the whole file! It parses only about half of it and thats it. The problem isnt the actionscript though.

I open the xml file in my html editor (dreamweaver), resave it and then flash loads the whole thing without a problem.

Im using IIS as my localhost and my webhost is running Apache/Linux.

The same exact problem happens when I generate the xml file from either of the two.

I thought it may have to do with the line breaks or with the fopen() function, but when i tried generating the xml file without tabs ( ) or linebreaks (
), I still have the problem.

Has this happened to anyone? can you please help?

Thanks.

Below is the code (is modified from the original to account for table relationships)

<?php
$host = “localhost”;
$user = “root”;
$pass = “”;
$database = “DB”;
$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 Sections”;
$resultID = mysql_query($query, $linkID) or die(“Data not found 1.”);
$xml_output = “<Menu>”;
for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
$row = mysql_fetch_assoc($resultID);
$xml_output .= “<Secciones>”;
$xml_output .= “<Sections>” . $row[‘Sections’] . “</Sections>”;
$xml_output .= “<SecID>” . $row[‘SecID’] . “</SecID>”;

$query2 = “SELECT * FROM Subsections WHERE (((Subsections.SecID)=” . $row[‘SecID’] . “))”;
$resultID2 = mysql_query($query2, $linkID) or die(“Data not found 2.”);
for($y= 0 ; $y < mysql_num_rows($resultID2) ; $y++){
$subsections_rows = mysql_fetch_assoc($resultID2);
$xml_output .= “<SubSecciones>”;
$xml_output .= “<SubSec>” . $subsections_rows[‘SubSec’] . “</SubSec>”;
$xml_output .= “<SecID>” . $subsections_rows[‘SecID’] . “</SecID>”;
$xml_output .= “<SubSecID>” . $subsections_rows[‘SubSecID’] . “</SubSecID>”;

$query3 = “SELECT * FROM Products WHERE (((Products.SubSecID)=” . $subsections_rows[‘SubSecID’] . “))”;
$resultID3 = mysql_query($query3, $linkID) or die(“Data not found 3.”);
for($z= 0 ; $z < mysql_num_rows($resultID3) ; $z++){
$products_rows = mysql_fetch_assoc($resultID3);
$xml_output .= “<Productos>”;
$xml_output .= “<ProdName>” . $products_rows[‘ProdName’] . “</ProdName>”;
$xml_output .= “<Price>” . $products_rows[‘Price’] . “</Price>”;
$xml_output .= “<Description>” . $products_rows[‘Description’] . “</Description>”;
$xml_output .= “<Photo>” . $products_rows[‘Photo’] . “</Photo>”;
$xml_output .= “<SubSecID>” . $products_rows[‘SubSecID’] . “</SubSecID>”;
$xml_output .= “<TienePDF>” . $products_rows[‘tienepdf’] . “</TienePDF>”;
$xml_output .= “</Productos>”;
}
$xml_output .= “</SubSecciones>”;
}
$xml_output .= “</Secciones>”;
}
$xml_output .= “</Menu>”;
$myFile = “…/menuphp.xml”;
$fh = fopen($myFile, ‘wb’) or die(“can’t open file”);
fwrite($fh, $xml_output);
fclose($fh);
$updateGoTo = “catalogo.php”;
header(sprintf(“Location: %s”, $updateGoTo));
?>