Formulas

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Formulas

Post by s.dot »

Code: Select all

SELECT
    `id`,
    `username`,
    `mainpic`,
    `user_last_visit`,
    POW((69.172*(`long`-\"{$zipdata['long']}\")*cos({$zipdata['lat']}/57.3)),\"2\")+POW((69.172*(`lat`-\"{$zipdata['lat']}\")),\"2\") AS `distance`
FROM
   `users`
In this query I know where 69.172 is coming from. But where is 57.3 coming from. If I pull this into an array $array['distance'] comes out as 85.3119036658 where I know it should be around 14.2 (according to google and yahoo maps)
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
GM
Forum Contributor
Posts: 365
Joined: Wed Apr 26, 2006 4:19 am
Location: Italy

Post by GM »

Hi - 57.3 is the conversion factor between radians and degrees:

1 radian = 57.3°


Who says a degree in Maths is useless? :wink:
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

GM wrote:Hi - 57.3 is the conversion factor between radians and degrees:

1 radian = 57.3°


Who says a degree in Maths is useless? :wink:
A degree in maths is possibly one of the most useful ones to have (opinion of course). Pretty much everything comes down to Mathematics in the end. I do remember the 360 degrees = 2 * PI radians though from A-Level (16-18 yrs).
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

d11wtq wrote:
GM wrote:Hi - 57.3 is the conversion factor between radians and degrees:

1 radian = 57.3°


Who says a degree in Maths is useless? :wink:
A degree in maths is possibly one of the most useful ones to have (opinion of course). Pretty much everything comes down to Mathematics in the end. I do remember the 360 degrees = 2 * PI radians though from A-Level (16-18 yrs).
Doing a degree in Maths will definitely improve the way one thinks. Maths and Science are the best subjects around and most of us do not realize this fact when we are younger.
Post Reply