Re: Multiple Markers from SQL
SoonerX, I have been through this, I know where you're at. I am
learning from evilc and I started with the 'Subfinder' tutorial:
http://www.map-server.com/googlemaps/tutorial_writing.html - I think
his name is Hans.
There are more here, reading polylines from database:
http://www.map-server.com/googlemaps/overview.html
Larry, I thought that was asp!
In the map code I use what Larry is saying, storing the values in an
array (this is a table that holds all the stuff from your database, it
is not on the page yet, the array is out of database and into a
'holding container') that the php 'loops' through - that it means it
goes through one line after another getting the data into your page
<?php
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("db567") or die(mysql_error());
$result = mysql_query("SELECT * FROM clubs");
while($row = mysql_fetch_array($result))
{
$info_text = "<br>" . $row['desc'] . "<br><br><a href=" . $row[url] . "
target=_blank>Link</a>";
echo "var point = new GPoint(" . $row['lon'] . "," . $row['lat'] .
");\n";
echo "var marker = createMarker(point, '" . $info_text . "','" .
$row['marker'] . "');\n";
echo "map.addOverlay(marker);\n";
echo "\n";
}
?>
So, I get from my database db567 the data in table 'clubs'
now the computer has it
THE LOOP: while is the key word
while there are results still in the array,
loop through and put the values with '$row
$row['desc'], $row[url] etc, these are the names of my fields in the
database.
Then, the rest of the map code - :
GEvent.addListener(map, 'click', function(overlay, point) {
if (overlay) { etc.,
0 Comments:
Yorum Gönder
<< Home