//pokaz na mapie
if($_POST["sposob_wyswietlania"]==2)
{
//echo "mapa";
?>
<script type="text/javascript">
//<![CDATA[
var map = new GMap(document.getElementById("map2"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.addControl(new GScaleControl());
map.setCenter(new GLatLng(51.512161, -0.14110), 11, G_NORMAL_MAP);
// Creates a marker whose info window displays the given number
function createMarker(point, number)
{
var marker = new GMarker(point);
// Show this markers index in the info window when it is clicked
var html = number;
GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(html);});
return marker;
};
var point = new GLatLng(51.513156,-0.131396);
var marker = createMarker(point, 'Track Records office, Old Compton Street');
map.addOverlay(marker);
//]]>
<?
$result = mysql_query("SELECT id, miasto, lat, lng data_dod FROM advert_have Where miasto=732 ORDER BY data_dod desc");
if (!$result)
{
}
{
echo "var point = new GLatLng(" . $row['lat'] . "," . $row['lng'] . ");\n"; echo "var marker = createMarker(point, '" . addslashes($row['data_dod']) . "');\n"; echo "map.addOverlay(marker);\n"; }
?>
</script>
<?
echo '<div id="map2" style="width: 500px; height: 300px"></div>'; }
problem jest w tym ze wyniki z bazy mysql nie wyswietlaja sie na mapie
jesli usune powyzszy kod php i zostawie w js
var point = new GLatLng(51.513156,-0.131396);
var marker = createMarker(point, 'Track Records office, Old Compton Street');
map.addOverlay(marker);
to punkt ten jest pokazany na mapie
natomiast gdy dodam ten powyzszy kod php z petla to nie wyswietla mi sie nawet pusta mapka