Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9162303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:10:40+00:00 2026-06-17T14:10:40+00:00

How do I retrieve value from mysql database and display in infowindow according to

  • 0

How do I retrieve value from mysql database and display in infowindow according to the markers?

Example first marker, info window should show “A”..For now, it shows everything. How do I do this? Please guide me through. Thanks!

<script>
        var map;
        var marker;
        var infowindow;

        var info = <?php echo json_encode($infoWindow); ?>;
        var placeX= <?php echo json_encode($getX); ?>;
        var placeY= <?php echo json_encode($getY); ?>;

        function initialize()
        {
            var mapProp = {
              center:new google.maps.LatLng(1.35208,103.81984),
              zoom:11,
              mapTypeId:google.maps.MapTypeId.ROADMAP
              };

            map = new google.maps.Map(document.getElementById("googleMap"),mapProp);

            for(var x=0; x<placeX.length; x++)
            {
                retrieve(placeX[x],placeY[x],info[x])
            }   

        }

        function retrieve(x,y,i)
        {
            var marker=new google.maps.Marker({
              position:new google.maps.LatLng(y,x),
              });

            marker.setMap(map);

            marker.setIcon('http://maps.google.com/mapfiles/ms/icons/green-dot.png')



            marker.info = new google.maps.InfoWindow ({content: '<b>No. of people who choose this location:</b> '+ info});
            google.maps.event.addListener(marker, 'click',function(){
                marker.info.open(map,marker);
                });

        }

        function addInfoWindow(x,y,h) 
        {
           var infowindow = new google.maps.InfoWindow({
              content:"Hello World!"
              });

            google.maps.event.addListener(marker, 'click', function() {
            infowindow.open(map,marker);
            });
        }

        google.maps.event.addDomListener(window, 'load', initialize);

    </script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T14:10:41+00:00Added an answer on June 17, 2026 at 2:10 pm

    The argument for retrieve that contains the info is i not info

    marker.info = new google.maps
    .InfoWindow ({content: '<b>No. of people who choose this location:</b> '+ i});
    //------------------------------------------------------------------------^
    

    Related to the comments:(apply a different marker for the highest values)

    Put this right after var info = <?php echo json_encode($infoWindow); ?>;


    max=Math.max.apply(null,info);
    

    it will define a variable max with the highest item of info as value.

    Now you can use this value for a conditional marker:

    marker.setIcon('http://maps.google.com/mapfiles/ms/icons/'+
                      ((i==max)?'red':'‌​green')+'-dot.png');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple php file that gets info from mysql database display inside
I want to retrieve value from mysql database and covert it into json. <?php
How to retrieve value from database of SQLite onto UILabel but not in UITableView
I'm trying to retrieve records from the mySQL-database but nothing gets selected. I'm using
I have a php file which retrieves data from a MySql database and display
i am using this php code to retrieve lat and lon from MySQL database,the
How to retrieve the mysql database value into array using java.If I retrieve Student
this is my xml file,i do not known how to retrieve value from xml
I have next problem, when I'm trying to retrieve value from xforms:select elements I
I need to retrieve a value from a website (can vary and I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.