Importing PHP file in Flash doesn't work



I'm extracting data from MySQL into flash. First I use PHP to query the DB, and then I echo the results.



$sql = "SELECT path FROM video WHERE id = 52";
$resource = mysqli_query($conn,$sql);

$row = mysqli_fetch_assoc($resource);
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<video>\n";
echo "<path>" . $row['path'] . "</path>\n";
echo "</video>\n";


I only have one root element, and I don't see anything wrong with my markup following the root element...but then again I'm wrong and I'm sure there is an error.


--- Changed my Title so I added the error message here ---



TypeError: Error #1088: The markup in the document following the root element must be well-formed.


------EDITED ------


The value of $row['path'] is a string from my DB. I know it's valid because I deleted all xml tags and echoed $row['path'] which is the url path for the video. I also used gettype(), and it outputs a string.


When I open this file into my browser, I actually don't see anything. It's a blank page, but it's because the browser is rendering it as html elements, so I don't think that's the problem. But when I view source, I get this



<?xml version="1.0" encoding="UTF-8"?>
<video>
<path>1.mp4</path>
</video>


In addition, I created a random file with an xml extension with the xml contents above, (copied it form View Source that my php file outputs) and it works fine. I see the contents in Flash. What could be wrong with echoing it out in a php file? I'm using textWrangler. It might have something to do with BOM, any suggestions?


No comments:

Post a Comment