PHP - codigo para crear xml

 
Vista:
Imágen de perfil de juan

codigo para crear xml

Publicado por juan (14 intervenciones) el 09/06/2014 20:46:24
buenas, estoy trancado porque no se porque funciona este codigo, agradezco ayuda.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
// Define the database info
// -- Modify for your case --
include ("conecta.php");
global $db_selected;
global $db;
$db = "datosgpx";
// Important so that the filetype is correct
header("Content-type: application/xml");
 
// Print the head of the document
printf("'<?'xml version='1.0' encoding='UTF-8''?>'
<kml xmlns=\"http://earth.google.com/kml/2.0\">
<Document>");
 
/* You can include a default map view using the following lines
// -- Delete this block if you don't need it --
printf("<LookAt>
  <latitude>42.390185</latitude>
  <longitude>-72.528412</longitude>
  <range>1200</range>
  <tilt>0</tilt>
  <heading>0</heading>
</LookAt>";*/

	$query = "SELECT * FROM datosgpx";
	    //$fecha = mysql_real_escape_string($fecha,$db);
		mysql_select_db ("datosgpx");
		$result = mysql_query($query);
			
	    // echo $result;
  // Now iterate over all placemarks (rows)
  while ($row = mysqli_fetch_object($result)) {

    // This writes out a placemark with some data
    // -- Modify for your case --
    printf('
      <Placemark id="%d">
        <name>%s says:</name>
        <description>%s</description>
        <Point>
          <coordinates>%f,%f</coordinates>
        </Point>
      </Placemark>',
    htmlspecialchars($row->fecha),
    htmlspecialchars($row->lat),
    htmlspecialchars($row->lon),
    htmlspecialchars($row->ele),
};

// Close the database connection
mysqli_close($db);

// And finish the document
printf("
</Document>
</kml>");

?>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de xve
Val: 3.943
Oro
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

codigo para crear xml

Publicado por xve (6935 intervenciones) el 09/06/2014 21:06:59
Hola Juan, no entiendo tu pregunta? el código funciona bien y no entiendes el porque? es esa tu pregunta?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de juan

codigo para crear xml

Publicado por juan (14 intervenciones) el 09/06/2014 21:10:15
tenes razon me triciono el subconciente, omiti el no previo a funciona, igual acabo de iniciar otro camino con otro problema, le voy a dar de baja a este. gracias.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar