i just cant seem t get this to work.....
heres the page: http://lifeinmegapixels.com/map.php?id=1
(vary the id #, seems to work when =2 but not others)
I have a page in php that is reading values for latitude and
longitude, and a description for a set (about 30) of points, from a
MYSQL database. I would like to place a marker for each point, whcih
comes up with the text in the description field when you click it.
However when i try it, it just doesnt work, the map wont load atall
unless the id=2, where the description just contains plain text, but
description is also plain text for id=1, which doesnt seem to work. I
have set the description for id's 3 and 4 to other variations i tried
without success. for all higher id's, the description contains full
html of the form "text <a target=\"blank\" href=http://
agooglemapslink.com/andalltherestofit >text </a> text".
The slashes around the blank and the lack of quotes around the href
are artifacts of me trying to make it all work.
So what format do i need the inner text in to make it work? despite it
being labeled a html window it doesnt seem to work when i give it
html....
any help appreciated, heres the original php code:
<?php
$val=$_GET['id'];
$con = mysql_connect("localhost","***_***","***");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("wjh31_Details", $con) or die(mysql_error());
$result=mysql_query("SELECT * FROM Details WHERE id=$val") or die
(mysql_error());
?>
<?php include 'header.php'; ?>
<script src="http://maps.google.com/maps?
file=api&v=2.x&sensor=false&key=ABQIAAAAW1VWMBk-
B33I5dtTdxv8uRQ0CIxrEBvySHXviYnnNgN8D9asJBQRzqdHcRU-
YW4FF8FYdHz8YnqdCA"
type="text/javascript"></script>
<script type="text/javascript">
function createMarker(lat, lng, html) {
var latlng = new GLatLng(lat, lng);
var marker = new GMarker(latlng);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
function initialize() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(0, 0), 3);
map.setUIToDefault();
map.setMapType(G_HYBRID_MAP);
<?php
while($row=mysql_fetch_array($result))
{
echo "map.addOverlay(createMarker($row[lat],
$row[lng], '$row
[Description]')); ";
}
?>
}
}
</script>
<div id="map_canvas" style="width: 800px; height: 600px; margin-left:
65;"></div>
<?php include 'footer.php';
mysql_close($con);
?>
N.B: the aim is to ultimately remove the WHERE id=$val bit and just
have it plot all point on the map, but ive got the id restriction on
just while i try and sort it out....
hope this is enough info...
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---