1

I have a MySql database with addresses and i want to embed google maps API showing one address.

How do i use google maps API to embed a map showing one of these addresses on a page.

please help

Thanks :D

geocodezip
  • 158,664
  • 13
  • 220
  • 245
Saeid Ghaferi
  • 123
  • 3
  • 11

2 Answers2

2

You can add an iframe pass the address from MySQL Database as an URL parameter.

<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.it/maps?q=<?php echo $yourAddress; ?>&output=embed"></iframe>
Atif Tariq
  • 2,650
  • 27
  • 34
1

You want to know the value of latitude and longitude to mark a place in the map. You can use Google API to get the latitude and longitude. Pass this values to the Google MAP. Get latitude and longitude check this link to get the latitude and longitude using Google API

script for the map canvas

<div id="map_canvas" style="width:650px; height:300px"></div>
lat = latitude value from Google API
lon = longitude value from Google API
var mapOptions = {
center: new google.maps.LatLng(lat,lon),
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP,
};
var map = new google.maps.Map(document.getElementById("map_canvas"),mapOptions);
Community
  • 1
  • 1
Vishnu Sureshkumar
  • 2,246
  • 6
  • 35
  • 52