0

Hi I'm trying to plot multiple values and successfully done using this variable.

    var locations = [
  ['Bacolod City', 10.64073 ,122.9689, 4],
  ['Bago City', 10.5333 ,122.8333, 5],
  ['Cadiz City', 10.950, 123.29, 3],
  ['Sipalay City', 9.7519, 122.40, 2],
  ['Kabankalan City', 9.896, 122.831, 1]
];

Now my next step is instead of static data like above, I would like to retrieve data from my mysql database and use it for var locations. Would appreciate any help on how to perform that. most i have seen is complicated and use json which i have no experience in. Thanks in advance.

Note:Btw I'm trying to plot using google maps api. sorry for not mentioning.

2
  • echo "var data = ".json_encode(data).";\n". That's not complicated. Commented Dec 17, 2012 at 15:37
  • @JanDvorak could you point me to a good tutorial? Commented Dec 17, 2012 at 15:53

2 Answers 2

1

You should read about Ajax or could use one of many tutorials: http://www.php4every1.com/tutorials/jquery-ajax-tutorial/

Sign up to request clarification or add additional context in comments.

Comments

0

If you look at the Articles section of the documentation there are several examples of how to use PHP/MySQL with the Google Maps API v3:

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.