Hello -

I am having trouble populating markers (created with longitude and
latitude from a MySQL database) with information from the same
database.

In the code below, if I change the line:

echo "var name = '".$name."';\n";

to:

echo "var name = ' ';\n";

The markers appear on the map but they are blank. With the code below
nothing appears on the page. Help? You can find a a sample of the page
(not working) at: http://www.stremas.com/googlemaps/test5.php

Many thanks!

------

<script type="text/javascript">
        function createMarker(point,name) {

        var marker = new GMarker(point,name);
       GEvent.addListener(marker,"click",function() {
  marker.openInfoWindowHtml(name);
});
       return marker;
      }


            function initialize() {
        if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map_canvas"),
{ size: new GSize(580,400) } );
                map.removeMapType(G_HYBRID_MAP);
                map.setCenter(new GLatLng(-3.703250,40.416741,0), 1);
                var mapControl = new GMapTypeControl();
                map.addControl(mapControl);
                map.addControl(new GLargeMapControl());


 <?  $exe1="SELECT name,latitude,longitude FROM map";
         $result1 = mysql_query($exe1, $db)or die(mysql_error());
         while(list($name,$latitude,$longitude) = mysql_fetch_row($result1))
{

                        echo "\n var point = new 
GLatLng(".$latitude.",".$longitude.");\n";
                        echo "var name = '".$name."';\n";
                        echo "var marker = createMarker(point,name);\n";
                    echo "map.addOverlay(marker);\n";
                    echo "\n";
        }
?>

}
    }

    </script>

--

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