Note that there are some explanatory texts on larger screens.

plurals
  1. POprint markers with v2 API with different order than the table info
    primarykey
    data
    text
    <p>i have a sql query and i pass the result with mysql_fetch_array into a while loop, and i am printing a table. The think is that with the same info included in each row i am building the markers on the map. As i am building the map, the problem is that the map always centered at the final row of the table (C marker). Instead of this i want the map centered to the marker A (first row of the table). I was searching about to reverse the array but doesn't work.</p> <pre><code> &lt;?php while($info4 = mysql_fetch_array($result4)) { ?&gt; // A function to create the marker and set up the event window function createMarker(point, name, html, flag) { //set the icon of the marker var letteredIcon = new GIcon(baseIcon); letteredIcon.image = "markers/"+flag+".png"; // Set up our GMarkerOptions object markerOptions = { icon:letteredIcon }; var marker = new GMarker(point, markerOptions); GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); // save the info we need to use later for the side_bar gmarkers.push(marker); // add a line to the side_bar html side_bar_html += '&lt;td&gt;&lt;a href="javascript:myclick(' + (gmarkers.length-1) + ')"&gt;' + name + '&lt;\/a&gt;&lt;\/td&gt;'; return marker; } // add the points map.setCenter(new GLatLng(&lt;?php print $info4['placeY'];?&gt;,&lt;?php print $info4['placeX'];?&gt;), 14); var point = new GLatLng(&lt;?php print $info4['placeY'];?&gt;,&lt;?php print $info4['placeX'];?&gt;); var marker = createMarker(point,"&lt;?php print utf8_decode($info4['placeName']);?&gt;","&lt;?php print utf8_decode($info4['placeName'])."&lt;br&gt;".utf8_decode($info4['placeAddress'])."&lt;br&gt;".utf8_decode($info4['placeDistrict']);?&gt;","&lt;?=$flag;?&gt;") map.addOverlay(marker); &lt;?php $flag=$flag+1; } ?&gt; </code></pre> <p>An example: Table:</p> <p>A Sight-seeing Odeon</p> <p>B Sight-seeing Phenomenon of Tides </p> <p>C Sight-seeing Red House</p> <p>In this example the map is centered on the C marker instead of A marker which i want to see.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload