Skip navigation links

MySQL Forums :: PHP :: MySql Query Help


Advanced Search

MySql Query Help
Posted by: Alan Lynch ()
Date: March 30, 2013 12:50AM

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

Options: ReplyQuote


Subject Written By Posted
MySql Query Help Alan Lynch 03/30/2013 12:50AM
Re: MySql Query Help Alan Lynch 03/30/2013 12:53AM
Re: MySql Query Help Peter Brawley 03/30/2013 06:20AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.