<?
$query = mysql_query("SELECT * FROM poi_example");
while ($row = mysql_fetch_array($query)){
$name=$row['name'];
$lat=$row['lat'];
$lon=$row['lon'];
$desc=$row['desc'];
echo ("addMarker($lat, $lon,'<b>$name</b><br/>$desc');\n");
}
?>
this code (echo) shows the table data in HTML source code.. is there another way (which does not shows the data) to extract markers from table?
thank you.
I prefer to render them as a JSON. You can either do that in-page as you have done above.
You can iterate over your
itemsarray in JavaScript.I presume your
addMarker()function creates a standard Google Map marker.Alternative, you can have a PHP script that fetches your items from the database as echoes them as a JSON string, and then just call that via AJAX with jQuery.
So your PHP script would simply be:
And then in your JavaScript file:
Hope this helps.