ok so im using google maps API to show the position of players in flight sim, their position LAT and Long is pulled from the database on page load.
the bottom of the page shows all pilots currently online, yet the map isnt showing the markers? what am i missing? Note i have posted only the google maps code. URL to page: http://sunward.dth-scripts.com/FSACARS/map/gmap_display.php ######################################################################################### END OF CODE ######################################################################################### <?php /* CHANGE THESE LINES TO YOUR DETAILS */ /* make connection to database */ $hostreal_name = "********"; $userreal_name = "****"; $pw = "****"; $dbreal_name = "****"; // Remember, you need to register with Google Map to get a valid registration key. // This key must be placed where I have put "###UR_KEY_HERE###" located in the <script src=> tag below. ?> <head> <!-- Place you google map key in the line below over the "###UR_KEY_HERE###" text If you do not have a key this will not work. You can obtain a key from http://www.google.com/apis/maps/ --> <script src="http://maps.google.com/maps? file=api&v=1&key=ABQIAAAAp0XHULtUv3JP47O2YNtuGRSxgBvHGY5vpydDSMZSR5g6XiB5JxQclETD0DwkfUdn_pDcQhh6aIUn6Q" type="text/javascript"></script> <link href="../css/css.css" rel="stylesheet" type="text/css" /> </head> <body class="content"> <p align="left" class="pageHeader">Current Flights.....</p> <div id="map" style="width: 750px; height: 500px"> </div> <script type="text/javascript"> // This is the google map part // Thes map settings are set to show Australia, so you will // need to change co ordinates to suit your needs. //<![CDATA[ //Center map on Alice Springs var map = new GMap(document.getElementById("map")); //$GMap->setMapType('G_SATALITE_TYPE'); map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl()); // Alice Springs // LAT LON // S2348'08.57 E13353'12.16 map.centerAndZoom(new GPoint(134.132080078125, -25.770059260080004), 1); map.setMapType(G_SATELLITE_TYPE); // Palo Alto // LAT LON // N3727'40.03 W12206'54.16 //map.centerAndZoom(new GPoint(-122.1419, 37.4419), 4); // 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; }; <?php $link = mysql_connect("$hostreal_name", "$userreal_name", "$pw") or die("Could not connect: " . mysql_error()); mysql_selectdb("$dbreal_name",$link) or die ("Can\'t use dbmapserver : " . mysql_error()); $result = mysql_query("SELECT * FROM positions WHERE last_update > DATE_SUB( NOW() , INTERVAL 15 MINUTE )", $link); if (!$result) { echo "no results "; } while($row = mysql_fetch_array($result)) { // This is the data displayed in the google map text box when you click on a pilot name $info = "Pilot: ".$row['pilot_num'] . "<br>" . "From: " . $row ['depAptICAO'] ." To: " . $row['destAptICAO'] . "<br>" . "Online: " . $row['Online'] . "<br>" . "GS: " . $row['gs'] . "<br>" . "ALT: " . $row ['alt'] . "<br>" . "ETA: " . $row['timeDestApt']; echo "var point = new GPoint(" . $row['lon'] . "," . $row['lat'] . "); \n"; echo "var marker = createMarker(point, '" . $info . "');\n"; echo "map.addOverlay(marker);\n"; echo "\n"; } mysql_close($link); ?> //]]> </script> ######################################################################################### END OF CODE ######################################################################################### --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
