Default username/password? Google Maps query

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Default username/password? Google Maps query

Postby jakc » 02. December 2007 18:44

Hi, first post, im completly new to php/apache/mysql so talk to me like im an idiot.
Im trying to get a google map sample running and connect to a mysql database to get the data to plot points.

Have got xampp running, created a database called gmap1
Created a table called wholocations
Populated this table with a dozen records (with lat/lon spatial information)
Got a google maps key.
Created a map, and trying to read from the database and populate the map with points.
Im not getting a "Could not connect" error but im not getting any points.
The map appears fine.
Using firefox and have got the code from this tutorial.

Cant see what im doing wrong. Perhaps I have my username details wrong, but from what I saw on php.net, I think im right. Can anyone spot where im going wrong?

Code: Select all
<html>
<head>
<title>Local Issues Example</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAABbQOcrHd1l2eJ82xX5iKoxT2yXp_ZAY8_ufC3CFXhHIE1NvwkxQYD0HysvPaUlb89IVQ-GMGKz0rYQ" type="text/javascript"></script>
</head>
<body>
<p><strong>Local Issues Example</strong></p>
<div id="map" style="width: 800px; height: 600px"></div>

<script type="text/javascript">
//<![CDATA[

var map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.addControl(new GScaleControl());
map.setCenter(new GLatLng(51.106971, -3.15307617), 8, G_NORMAL_MAP);

// 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", "root", "") or die("Could not connect: " . mysql_error());
mysql_selectdb("gmap1",$link) or die ("Can\'t use dbmapserver : " . mysql_error());

$result = mysql_query("SELECT * FROM wholocations",$link);
if (!$result)
{
echo "no results ";
}
while($row = mysql_fetch_array($result))
{
echo "var point = new GLatLng(" . $row['lat'] . "," . $row['lon'] . ");\n";
echo "var marker = createMarker(point, '" . addslashes($row['description']) . "');\n";
echo "map.addOverlay(marker);\n";
echo "\n";
}

mysql_close($link);
?>

//]]>
</script>

</body>
</html>
:)
jakc
 
Posts: 3
Joined: 02. December 2007 18:37

Postby Izzy » 02. December 2007 19:14

Did you name the script with a .php file extension?

Did you put the script in the htdocs directory?

Did You load the script through a your browser?
http://localhost/yourmap.php


===========================================
1. The new DeskTopXampp Launch Control for XAMPP / XAMPPlite
Posted by Ridgewood available from Ridgewood'sDTX web site

2. Build Rich AJAX Applications - Faster
TIBCO General Interface Pro Edition but FREE and Open Source
Fully working with NO donations required to get a user/password
===========================================
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby jakc » 02. December 2007 19:18

no on all 3 accounts.
Will try again now.
jakc
 
Posts: 3
Joined: 02. December 2007 18:37

Postby jakc » 02. December 2007 19:25

hmm, still not showing me any points, or giving me any error message.

That would suggest to me that the php is not being run at all? Im lost. any more pointers?
jakc
 
Posts: 3
Joined: 02. December 2007 18:37


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 164 guests