Tema: crear xml
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/06/2014, 12:24
jegggf
 
Fecha de Ingreso: septiembre-2012
Ubicación: montevideo
Mensajes: 131
Antigüedad: 11 años, 7 meses
Puntos: 0
crear xml

agradezco ayuda porque no entiendo porque no me funciona el siguiente codigo gracias.

Código PHP:


<?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>"
);

?>