diff options
| author | Comment <tim@gray.(none)> | 2013-05-08 22:59:04 +0100 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2013-05-08 22:59:04 +0100 |
| commit | 4f81e9399051cc90ccddeb69b785d7422a28a1ff (patch) | |
| tree | ea5187184ed61114b9315371e5c2d709bdf26c4f /tableKML.php | |
initial commit
Diffstat (limited to 'tableKML.php')
| -rw-r--r-- | tableKML.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tableKML.php b/tableKML.php new file mode 100644 index 0000000..d0daaae --- /dev/null +++ b/tableKML.php @@ -0,0 +1,32 @@ +<?php +include 'config.php'; + +mysql_connect($host, $login, $pword) or die(mysql_error()); +mysql_select_db($db) or die(mysql_error()); + +$table= $_GET['table']; + +$query='SELECT * FROM '.$table; +$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"; + +$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; +} +mysql_close(); + +echo "</kml>\n"; +?> |
