Hi, thank you...
I made this two functions now:
the one with the map(just the javascript here):

<script type="text/javascript">
var latitude =<?php echo $row_rsLatLng['lat']; ?>;
var longitude = <?php echo $row_rsLatLng['lng']; ?>;
var ponto = new GLatLng(latitude, longitude);
var marker = new GMarker(ponto, {draggable:true});
function load()
{
        if (GBrowserIsCompatible())
        {
        var map = new GMap2(document.getElementById("map"));
        map.setCenter(ponto, 15);
                map.addControl(new GOverviewMapControl());
                map.addControl(new GMapTypeControl());
                map.addControl(new GSmallMapControl());
                map.addOverlay(marker);
        }
}

function save(){
        var latlng = marker.getLatLng();
        var lat = latlng.lat();
        var lng = latlng.lng();
        var url = "save.php?lat="+ lat + "&lng=" + lng;
        GDownloadUrl(url,function(data){});
        window.location='index.html';
}
</script>

and the save.php

<?php require_once('../../Connections/connForm.php'); ?>
<?php

mysql_select_db($database_connForm, $connForm);
$query_rsForm = "SELECT * FROM cadastro ORDER BY id DESC LIMIT 1";
$rsForm = mysql_query($query_rsForm, $connForm) or die(mysql_error());
$row_rsForm = mysql_fetch_assoc($rsForm);
$totalRows_rsForm = mysql_num_rows($rsForm);

// Gets data from URL parameters
$lat = $_GET["lat"];
$lng = $_GET["lng"];


// Insert new row with user data
$query = sprintf("UPDATE cadastro SET lat='%s',lng='%s' WHERE id='".
$row_rsForm['id']."'",
         mysql_real_escape_string($lat),
         mysql_real_escape_string($lng));

$result = mysql_query($query);

if (!$result) {
  die('Invalid query: ' . mysql_error());
}


mysql_free_result($rsForm);
?>

There's a error in save php:  Invalid query: Data truncated for column
'lat' at row 1, but even so the function is working...
Do you know what kind of problem is this?

Thank you
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to