This is the code used by my php script to generate XML
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<videos>\n";
while ($line = mysql_fetch_assoc($Recordset1 ) ) {
echo "<video url =".$line['photo2']."/>\n";
}
echo "</videos>\n";
when processed it returns:
<?xml version="1.0" encoding="UTF-8"?>
<videos>
<video url =movie_2.swf/>
<video url =movie_3.swf/>
<video url =fk20.swf/>
</videos>
what is missing here are the quotes (") before movie and after swf
If I escape these quotes (\") then there is a processing error happening:
echo "<video url =\".$line['photo2'].\"/>\n";
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /mnt/sites/mysite.com/web/directory/banner.php on line 43
Has anyone an answer to this puzzle?
PHP XML Problem
Moderator: General Moderators
Re: PHP XML Problem
Maybe it will help you.
Don't confuse a concatenation operator (.) with the quotes (")
Code: Select all
//...
echo "<video url =\"".$line['photo2']."\"/>\n";
//...