summaryrefslogtreecommitdiff
path: root/tableKML.php
diff options
context:
space:
mode:
Diffstat (limited to 'tableKML.php')
-rwxr-xr-x[-rw-r--r--]tableKML.php31
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('&', '&amp;', $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;
+
?>