Como actualizo una consulta en php

woliveros
24 de Junio del 2008
Tengo UNa consulta en postgres pero necesito que transcurridos unos 10 seg se actualice para que un script que se encarga de pintar en un api de google maps se actualice unas marcas que yo lanzo este es el ecript que tengo que pinta las marca
<script type='text/javascript'>

function load(){
if (GBrowserIsCompatible()) {";

$result = pg_query($consulta ) or die ('no puedo entrar');
//This.Requery();
echo"
var map = new GMap2(document.getElementById('map_canvas'));
map.setCenter(new GLatLng(".$latitud1.", ".$longitud1."), ".$zoom.");
map.addControl(new GMapTypeControl());
map.addControl(new GOverviewMapControl());
map.addControl(new GScaleControl());
map.addControl(new GMapTypeControl());
map.addControl(new GLargeMapControl());

var baseIcon = new GIcon();
baseIcon.iconSize = new GSize(20, 20);
baseIcon.shadowSize = new GSize(37, 34);
baseIcon.iconAnchor = new GPoint(9, 34);
baseIcon.infoWindowAnchor = new GPoint(9, 2);
baseIcon.infoShadowAnchor = new GPoint(18, 25);
//mgr = new MarkerManager(map, {trackMarkers:true});
window.setTimeout(setupOfficeMarkers, 0);

function createMarker(point, index,address) {
var letter = String.fromCharCode('A'.charCodeAt(0) + index);
var letteredIcon = new GIcon(baseIcon);
letteredIcon.image = 'imagenes/truck.gif';
markerOptions = { icon:letteredIcon };
var marker = new GMarker(point, markerOptions);
GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml(' '+address+' <b></b>');
});
return marker;
}
var bounds = map.getBounds();
var southWest = bounds.getSouthWest();
var northEast = bounds.getNorthEast();
var lngSpan = northEast.lng() - southWest.lng();
var latSpan = northEast.lat() - southWest.lat();
var i=0;
";

while($linea = pg_fetch_row($result)){
$nom = $linea[0];
$placa = $linea[1];
$fecha = $linea[2];
$latitud = $linea[3];
$longitud = $linea[4];
$posicion = $linea[5];
echo"
var point = new GLatLng(".$latitud.", ".$longitud.");
var address = '<b>".$placa."</b><br/><i>".$fecha."</i><br /><a>".$posicion."</a>';
map.addOverlay(createMarker(point, i,address));
setInterval('".recarga."',1000);
setInterval('map.addOverlay(createMarker(point, i,address))',1000);

";

}
echo "}
}GSearch.setOnLoadCallback(initialize);
function setupOfficeMarkers() {
allmarkers.length = 0;
for (var i in officeLayer) {
var layer = officeLayer[i];
var markers = [];
for (var j in layer['places']) {
var place = layer['places'][j];
var icon = getIcon(place['icon']);
var title = place['name'];
var posn = new GLatLng(place['posn'][0], place['posn'][1]);
var marker = createMarker(point, i,address);
markers.push(marker);
allmarkers.push(marker);
}
mgr.addMarkers(markers, layer['zoom'][0], layer['zoom'][1]);
}
mgr.refresh();
}

function reloadMarkers() {";
$consulta = "select id_movil, placa, fecha, latitud, longitud, posicion, velocidad, kilometros, direccion
from moviles
where id_empresa = 0
and moviles.estado !=0
order by placa";

$result = pg_query($consulta ) or die ('no puedo entrar');



echo"}
</script>
</head>
<body onload='load()' onunload='GUnload()'>
<!--<input type='button' onclick='reloadMarkers()' value='reload all markers' />-->
<div id='map_canvas' style='width: 100%; height: 750px'></div>
</body>
</html>
";

?>