View Single Post
Old 31-07-2005, 00:18   #14
Raistlin
Inactive
 
Join Date: Feb 2004
Location: There's no place like 127.0.0.1
Services: Depends on the person and the price they're offering
Posts: 12,384
Raistlin is seeing silvered starsRaistlin is seeing silvered starsRaistlin is seeing silvered stars
Raistlin is seeing silvered starsRaistlin is seeing silvered starsRaistlin is seeing silvered starsRaistlin is seeing silvered starsRaistlin is seeing silvered starsRaistlin is seeing silvered starsRaistlin is seeing silvered starsRaistlin is seeing silvered starsRaistlin is seeing silvered starsRaistlin is seeing silvered starsRaistlin is seeing silvered starsRaistlin is seeing silvered stars
Re: PHP/SQL Help Please

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?
Raistlin is offline   Reply With Quote