how can i make an echo, preserve html information, and make a while from a query? i want to generate an kml file with mysql data. here is what i've done:
echo '<xml version=\"1.0\" encoding=\"UTF-8\"></br>';
echo '<kml xmlns=\"http://www.opengis.net/kml/2.2\" xmlns:gx=\"http://www.google.com/kml/ext/2.2\" xmlns:kml=\"http://www.opengis.net/kml/2.2\" xmlns:atom=\"http://www.w3.org/2005/Atom\"></br>';
echo '<Document></br>';
echo '<Placemark id='.$row['id'].' ></br>';
echo ' <name>'.$row['icao'].'</name></br>';
echo ' <description>'.$row['name'].'</description></br>';
echo ' <Point></br>';
echo ' <coordinates>'.$row['lat'].','.$row['lon'].'</coordinates></br>';
echo ' </Point></br>';
echo '</Placemark></br>';
echo '</Document></br>';
echo '</kml>';
The result should be this:
<xml version="1.0" encoding="UTF-8">
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<Placemark id='id'>
<name>'icao'</name>
<description>'name'</description>
<Point>
<coordinates>'lat','lon'</coordinates>
</Point>
</Placemark>
</Document>
</kml>
But i got that:
id icao name lat lon id icao name lat lon id icao name lat lon
So, how can i retain the kml tags (<Placemark>, <Document>, <kml>, ...)
, inside an php echo?