Jump to content

Search the Community

Showing results for tags 'distance'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hello guys I came acrross with some information to display my database results given latitude and longitude values and sort it by distance so far it works good but I was wondering how could i echo the actual distance between starting point and my results? my database is pretty straight forward: id, username, lat (latitude), lng (longitude) and a couple more things that will not be used right now.... the sql request code: $find = mysql_query("SELECT username, lat, lng, SQRT( POW(69.1 * (lat - '".$latitude."'), 2) + POW(69.1 * ('".$longitude."' - lng) * COS(lat / 57.3), 2)) AS distance FROM users WHERE username != '".$usern."' HAVING distance >= 0 ORDER BY distance ASC"); while($row = mysql_fetch_array($find)) { echo "<br />".$row['username']; } $latitude and $longitude is the current logged in member's location information so, I would like to know how to echo the actual distance in miles??? so i could do something like : echo $username."" is ".$distance." mile(s) from you..."; Thanks in advance!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.