Quote:
|
Originally Posted by Paul M
I think the server is unlikely to execute the php because you have used a .htm file extension - which it will simply serve up as a static html page.
|
Well spotted
It seems to be running the PHP now, if you check out:
http://www.catsworthpcs.co.uk/maps/example.php
You will see the result
All I get now is a little grey // towards the bottom of the page.
Here's the complete HTML:
PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="http://maps.google.com/maps?file=api&v=1&key=ABQIAAAA_0Z8PeM-XgTpnTEQ2Eu_dhS9v8dKVB9YxxVRvDfddQklYutOPxSzQleklTrdQ1Oj9gVkdwpq6oq7uQ" type="text/javascript"></script>
</head>
<body>
<div id="map" style="width: 500px; height: 400px"></div>
<script type="text/javascript">
//<![CDATA[
var map = new GMap(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.centerAndZoom(new GPoint(***), 12);
// 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('localhost', '***', '***')
or die("Could not connect: " . mysql_error());
mysql_selectdb('***',$link) or die ("Can\'t use dbmapserver : " . mysql_error());
$result = mysql_query("SELECT * FROM '***'",$link);
if (!$result)
{
echo "no results ";
}
while($row = mysql_fetch_array($result))
{
echo "var point = new GPoint(" . $row['lon'] . "," . $row['lat'] . ");\n";
echo "var marker = createMarker(point, '" . $row['desc'] . "');\n";
echo "map.addOverlay(marker);\n";
echo "\n";
}
mysql_close($link);
?>
//]]>
</script>
</body>
</html>
</body>
</html>
Have I made another dumb mistake somewhere?