Hi guys

Something has just happened to my google map with markers while I was
trying to update it. I was importing the .csv file in to my database
to update my markers but it kept importing to a new table (I realise
now what I was doing wrong) but in the mean time, I deleted the
original table, created it again, imported my .csv and now my markers
aren't displaying.

I've double checked that i've created the table the same way as
previously and everything seems to be ok, but for some reason my
markers just won't show up on my map.

My php file contains the following:

<?php

require("mapsql.php");

// Start XML file, create parent node

$dom = new DOMDocument("1.0");
$node = $dom->createElement("markers");
$parnode = $dom->appendChild($node);

// Opens a connection to a MySQL server

$connection=mysql_connect (localhost, $username, $password);
if (!$connection) {  die('Not connected : ' . mysql_error());}

// Set the active MySQL database

$db_selected = mysql_select_db($database, $connection);
if (!$db_selected) {
  die ('Can\'t use db : ' . mysql_error());
}

// Select all the rows in the markers table

$query = "SELECT * FROM markers WHERE 1";
$result = mysql_query($query);
if (!$result) {
  die('Invalid query: ' . mysql_error());
}

header("Content-type: text/xml");

// Iterate through the rows, adding XML nodes for each

while ($row = @mysql_fetch_assoc($result)){
  // ADD TO XML DOCUMENT NODE
  $node = $dom->createElement("marker");
  $newnode = $parnode->appendChild($node);
  $newnode->setAttribute("lat", $row['lat']);
  $newnode->setAttribute("lng", $row['lng']);
}

echo $dom->saveXML();

?>

And my table is as follows:
table name: markers
columns:
1 - title: ID, type: INT, auto_increment on
2 - title: lat, type: FLOAT, value 10,6
3 - title: lng, type: FLOAT, value 10,6
4 - title: type, type: VARCHAR, value 30

Can someone please help?

Thanks, Adrian

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" 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-js-api-v3?hl=en.

Reply via email to