Quantcast
Channel: MySQL Forums - PHP
Viewing all articles
Browse latest Browse all 938

MySql Query Help (2 replies)

$
0
0
Hi professionals.

i am new to php and mysql and I am trying to query my database to calculate the distance with the help from google instructions on this page.

https :// developers.google.com/maps/articles/phpsqlsearch_v3

when I try to query my database with the following query as advised by them no results are returned. here is my query, I think it is because of the order of exectuion of sql statement and it does not recognise the "distance" column name

SELECT suburb, state, latitude, longtitude, ( 6371 * acos( cos( radians(153) ) * cos( radians( latitude ) ) * cos( radians( longtitude ) - radians(-27) ) + sin( radians(153) ) * sin( radians( latitude ) ) ) ) AS distance FROM Postcode HAVING distance < 25 ORDER BY distance

any ideas as I really need the distance < 25 part so users can search by distance

thanks

Viewing all articles
Browse latest Browse all 938

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>