Código PHP:
<?php
include ("conecta.php");
$file=fopen("1.kml","a") or die("Problemas");
fputs($file,"<?xml version='1.0' encoding='UTF-8'?><kml xmlns='http://www.opengis.net/kml/2.2'>\n");
fputs($file,"<Document>\n");
$query = "SELECT * FROM datosgpx";
mysql_select_db ("datosgpx");
$result = mysql_query($query);
if ($result)
{
while($row = mysql_fetch_array($result))
{
$fecha = $row["fecha"];
$lat = $row["lat"];
$lon = $row["lon"];
$ele = $row["ele"];
$name = $row["name"];
$cmt = $row["cmt"];
parte problematica!
[SIZE="5"][COLOR="Red"][COLOR="DarkOrchid"]
if($cmt == "f"){
$cmt = "http://maps.google.com/mapfiles/kml/paddle/ltblu-blank.png";
}
else{
$cmt = "http://maps.google.com/mapfiles/kml/paddle/ylw-blank.png";
}
[/COLOR][/COLOR][/SIZE]
fputs($file,"<Placemark><name>$name</name> <description>$fecha</description> <Style id='randomColorIcon'><IconStyle><scale>1.1</scale><Icon><href>$cmt</href></Icon></IconStyle></Style><Point><coordinates>$lat, $lon,$ele</coordinates></Point></Placemark>");
}
}
else
{
echo mysql_error();
}
fputs($file,"</Document></kml>");
fclose($file);
mysql_close();
?>