Hi, I am trying to shows prices in the labeled markers
from MySQL table and my code below :
<script type="text/javascript">
var map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.enableGoogleBar();
map.setMapType(G_NORMAL_MAP);
// Create a base icon
var baseIcon = new GIcon();
baseIcon.image = "hotel.png";
baseIcon.shadow = "shadow.png";
baseIcon.iconSize = new GSize(85, 55);
baseIcon.shadowSize = new GSize(85, 54);
baseIcon.iconAnchor = new GPoint(9, 34);
baseIcon.infoWindowAnchor = new GPoint(9, 2);
baseIcon.infoShadowAnchor = new GPoint(18, 25);
var letteredIcon = new GIcon(baseIcon);
markerOptions = {
icon:letteredIcon,
labelText: index,
labelFont: "Arial,Verdana,sans-serif",
labelClass: "glabel",
labelOffset: new GSize(12, -12)
};
var marker = new LabeledMarker(point,markerOptions);
<?php
$link = mysql_connect($dbserver, $username, $password)
or die("Could not connect: " . mysql_error());
mysql_select_db($dbname,$link) or die ("Can\'t use database : " .
mysql_error());
$initial_lat = 40.6544;
$initial_lng = 22.9947;
$sql= "SELECT latitude,longitude,price_from,
(((acos(sin(('$initial_lat'*pi()/180)) * sin((latitude*pi()/180))
+cos(('$initial_lat'*pi()/180)) * cos((latitude*pi()/180)) *
cos((('$initial_lng' - longitude)*pi()/180))))*180/pi())*60*1.1515) as
distance FROM agoda_hotel HAVING distance <= 100 ORDER BY distance
LIMIT 0, 50";
$result= mysql_query($sql);
if(mysql_num_rows($result)==0){
echo "Rota nao encontrada!";
exit;
}
mysql_result($result,0,"latitude");
mysql_result($result,1,"longitude");
mysql_result($result,2,"price_from");
$initial_zoom = 12; // 1 through 17
echo "map.setCenter(new GLatLng(".$initial_lat.",".$initial_lng."),".
$initial_zoom.");\n";
while($row = mysql_fetch_array($result))
{
echo "var point = new GLatLng(" . $row['0'] . "," . $row['1'] . ");
\n";
echo "var marker = new LabeledMarker(point,". $row['2'] . ");\n";
echo "map.addOverlay(marker);\n";
echo "\n";
}
mysql_close($link);
?>
</script>
However google maps not loads anything and the Javascript
console returns the error :
"Erro: syntax error
source code : http://trekhotel.com/bina/html/track2.php
Line: 52, Column: 37
var marker = new LabeledMarker(point,);
---------------------------------------------------------|
Only the 1st record not displayed but following records
are show right please select the source of page.
thanks.
--
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.