0

In location table i have these columns:lat,long,date,userid

i want to display how much distance covered by particular user with my location table.

How to calculate distance in kilometer with help of lat long and query for this to display this data front side.

please refer below image for the same.location table data

Sami Kuhmonen
  • 30,146
  • 9
  • 61
  • 74

1 Answers1

0

I would consider this a duplicate question.

Please see: Measuring the distance between two coordinates in PHP

Or google the Haversine formula.

Community
  • 1
  • 1
FredMan
  • 861
  • 7
  • 19
  • how to use it for dynamic values – AMIT SUTAR MUMBAIKAR Mar 11 '17 at 06:15
  • Sorry, I don't understand. The formulas listed in the answer on the question that I linked to has a function which you can use. the prototype is (lat,long,lat,long, radius of earth) which can be used in php once you pull the data. Alternatively you could implement the same math to generate an additional field in mysql. – FredMan Mar 11 '17 at 16:40