Ver Mensaje Individual
  #7 (permalink)  
Antiguo 13/06/2014, 15:21
jegggf
 
Fecha de Ingreso: septiembre-2012
Ubicación: montevideo
Mensajes: 131
Antigüedad: 11 años, 7 meses
Puntos: 0
Respuesta: tomar valores con foreach

lamentablemente funciona, pero no aca:
Código PHP:
Ver original
  1. $gpx= simplexml_load_file('1.gpx');
  2.  
  3. foreach($gpx->wpt as $wpt) {
  4.     $lat   = $wpt['lon'];
  5.     $lon   = $wpt['lat'];
  6.     $ele   = $wpt->ele;
  7.     $fecha = $wpt->{'time'};
  8.     $fecha = substr($fecha,0,10);
  9.     $name  = $wpt->name;
  10.     $cmt   = $wpt->cmt;
  11.    
  12.     $query = "INSERT INTO $usertable (fecha,lat,lon,ele,name,cmt) VALUES ('$fecha','$lat','$lon','$ele','$name','$cmt')";  
  13.     //echo $query;
  14.     mysql_query($query,$db);
  15. }
si bien toma los valores me corta el bucle, alguna idea?