diff options
| author | Comment <tim@gray.(none)> | 2013-05-20 21:43:30 +0100 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2013-05-20 21:43:30 +0100 |
| commit | ce58f84fda93e6089caa5b724110dc7e01feddd1 (patch) | |
| tree | 5a51419580b33adf219ce6d0073ab9ab390f74b3 /tableKML.php | |
| parent | 4f81e9399051cc90ccddeb69b785d7422a28a1ff (diff) | |
tidying up
Diffstat (limited to 'tableKML.php')
| -rwxr-xr-x[-rw-r--r--] | tableKML.php | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/tableKML.php b/tableKML.php index d0daaae..1007f42 100644..100755 --- a/tableKML.php +++ b/tableKML.php @@ -1,4 +1,9 @@ +<?php //ini_set('display_errors','1');ini_set('display_startup_errors','1');error_reporting(E_ALL|E_STRICT); ?> <?php + +header("Content-Type: application/vnd.google-earth.kml+xml; charset=utf-8"); +//header("Content-Type: text/html; charset=utf-8"); + include 'config.php'; mysql_connect($host, $login, $pword) or die(mysql_error()); @@ -11,22 +16,28 @@ $result = mysql_query($query); #http://stackoverflow.com/questions/1567758/best-way-to-use-jquerys-ajax-function-retrieve-variables-from-a-php-script -echo "<?xml version='1.0' encoding='UTF-8'?>\n"; -echo "<kml xmlns=\'http://www.opengis.net/kml/2.2\'>\n"; +$output = ''; +$output .= "<?xml version='1.0' encoding='UTF-8'?>\n"; +$output .= "<kml xmlns='http://www.opengis.net/kml/2.2'>\n"; $n=mysql_numrows($result); $i=0; + while ($i < $n) { $T=mysql_fetch_array($result, MYSQL_ASSOC); - echo "<Placemark>\n"; - echo "<name>".$T[name]."</name>\n"; - echo "<Point>\n"; - echo "<coordinates>".$T[lat].",".$T[lng].",0</coordinates>\n"; - echo "</Point>\n"; - echo "</Placemark>\n"; - $i+=1; + $output .= "<Placemark>\n"; + $output .= "<name>".str_replace('&', '&', $T['name'])."</name>\n"; + $output .= "<Point>\n"; + $output .= "<coordinates>".$T['lat'].",".$T['lng'].",0</coordinates>\n"; + $output .= "</Point>\n"; + $output .= "</Placemark>\n"; + $i +=1; + } mysql_close(); -echo "</kml>\n"; +$output .= "</kml>\n"; + +echo $output; + ?> |
