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 7607055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:33:54+00:00 2026-05-31T00:33:54+00:00

Basically what I have is a sql database with various data points in it

  • 0

Basically what I have is a sql database with various data points in it (name, email, etc.) and importantly fields that contain addresses. What I am attempting to do is use these addresses (possibly just the zip codes?) to plot pins on a google map with their geocoding system. I know that i need to collect all of the zips from the database in an array and do some sort of foreach for every zip but I am unsure of how to do this. Here is what I have so far, can anyone help me?

<?php
$dbh=mysql_connect('my_database_host.edu','my_database_user','my_database_password');

if (!$dbh)
  {
  die('Could not connect: ' . mysql_error());
  } 
mysql_select_db('my_database_name', $dbh);

$query = "SELECT fldZip FROM tblLocation";
$findzips = mysql_query($query);
while($row =mysql_fetch_array($findzips)) {
    echo $row['fldZip'];
    }

?>

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <style type="text/css">
      html { height: 100% }
      body { height: 100%; margin: 0; padding: 0 }
      #map_canvas { height: 100% }
    </style>
    <script type="text/javascript"
      src="http://maps.googleapis.com/maps/api/js?key=my_api_key&sensor=false">
    </script>
    <script type="text/javascript">
  var geocoder;
  var map;
  function initialize() {
    geocoder = new google.maps.Geocoder();
    var latlng = new google.maps.LatLng(-34.397, 150.644);
    var myOptions = {
      zoom: 8,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

}

  function codeAddress(address) {
    geocoder.geocode( { 'address': address}, function(results, status) {
      if (status == google.maps.GeocoderStatus.OK) {
        map.setCenter(results[0].geometry.location);
        var marker = new google.maps.Marker({
            map: map, 
            position: results[0].geometry.location
        });
      } else {
        alert("Geocode was not successful for the following reason: " + status);
      }
    });
  }
</script>
</head>
<body onload="initialize()">
<div id="map_canvas" style="height:90%;top:30px"></div>
</body>
</html>
  • 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-05-31T00:33:55+00:00Added an answer on May 31, 2026 at 12:33 am

    Instead of using the Javascript-API to geocode the ZIPs use the geocoding-webservice via PHP.

    That also would be a good point to store the LatLng’s inside the DB, so you don’t have to request them again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created an application which inserts data into a SQL database. Basically, from
I have a History Table in SQL Server that basically tracks an item through
I have the following data that basically I only need a few bits of
Basically, I have a Sql Server database whose schema changes. When this happens, I
I have a local SQL Server Express database that I want to copy to
I have a Sql-Server-2008 database that I am querying from on the regular that
Can we have a SQL query which will basically help in viewing table and
I basically have 7 select statements that I need to have the results output
I have an SQL database table, I want to find everything in a table
I have limited SQL background, basically a small amount of manipulation through HTML and

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.