$south AND lat<$north AND lon>$west AND lon<$east ORDER BY title LIMIT 100"; } else { $query = "SELECT id, title, description, lat, lon FROM articlecoordinates WHERE needphotos=1 ORDER BY title LIMIT 100"; } $result = mysql_query($query) or die('Query failed: ' . mysql_error()); while ( $row=mysql_fetch_assoc($result)) { if ($update==1) $placemarks_str.=print_update_placemark($row); else $placemarks_str.=print_placemark($row); } mysql_free_result($result); if ($update==1) echo print_update_kml($placemarks_str); else echo print_kml($placemarks_str); function print_kml($placemarks_str) { $str="\n"; $str.="\n"; $str.="\n"; $str.="\n"; $str.="0\n"; $str.="#radioFolderExample\n"; $str.="$placemarks_str"; $str.="\n"; $str.="\n"; return $str; } function print_placemark($c) { $str=" " .str_replace("_", " ", $c['title']) ." lue lisää )]]> " .$c['lon'] ."," .$c['lat'] .",0 "; return $str; } ?>