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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:23:01+00:00 2026-06-10T23:23:01+00:00

I have a website where I store locations in a MySQL database and GeoCode

  • 0

I have a website where I store locations in a MySQL database and GeoCode using the address provided by the database.

Now I want to add a feature which will find the closest places to the specified point e.g. the location they are standing now or typing. I’m coding the geocoder and google maps in JavaScript and jQuery and I get the results using PHP to fetch from the database.

I read about the viewport but I can’t figure out how it would work in my situation where I need to show my own database locations and not Google’s.

Can anybody help? And it would be awesome if you have some kind of example.

  • 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-10T23:23:02+00:00Added an answer on June 10, 2026 at 11:23 pm

    radius search:

    select *,
        acos(cos(centerLat * (PI()/180)) *
         cos(centerLon * (PI()/180)) *
         cos(lat * (PI()/180)) *
         cos(lon * (PI()/180))
         +
         cos(centerLat * (PI()/180)) *
         sin(centerLon * (PI()/180)) *
         cos(lat * (PI()/180)) *
         sin(lon * (PI()/180))
         +
         sin(centerLat * (PI()/180)) *
         sin(lat * (PI()/180))
        ) * 3959 as Dist
    from TABLE_NAME
    having Dist < radius
    order by Dist
    

    3959 is the Earth radius in Miles. Replace this value with
    radius in KM, or any unit, to get results on the same unit.
    centerLat and centerLon are the center of the search (your
    input), while lat and lon are fields in the table.

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

Sidebar

Related Questions

i have website of application which sells applications online.on the home page i want
I have a website form that collects url of users to store in a
I'm about to create a user based website and will have to store photo,
On my website, I have an upload story feature with a user written title
I have website on the server, which is not precompiled (with source code, so
I have website where users can login with their Facebook account. I am using
I have a website where near locations are shown for each item, based on
I have a web site. This is a drupal site using PostgreSQL database.In this
I want to have a local copy of a gallery on a website. The
So I've build this website in MVC3 in which I am using the default

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.