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
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