abrahamgarcia27 Posted February 9, 2014 Share Posted February 9, 2014 I have this query that is not working and i have a feeling it has to do with the equation. Could some one take a look and see where i could be going wrong $sql = "SELECT name, category_id, image, ( 3959 * acos( cos( radians(37) ) * cos( radians( $latitude ) ) * cos( radians( $longitude ) - radians(-122) ) + sin( radians(37) ) * sin( radians( $latitude ) ) ) ) AS distance FROM `".TABLE_RESTAURANTS."` HAVING distance < 25 ORDER BY distance LIMIT 0 , 20"; Quote Link to comment Share on other sites More sharing options...
.josh Posted February 9, 2014 Share Posted February 9, 2014 define "not working". Do you get an error message? Or what is it doing vs. what should it be doing? Quote Link to comment Share on other sites More sharing options...
Solution abrahamgarcia27 Posted February 9, 2014 Author Solution Share Posted February 9, 2014 Sorry i was not reading the example correctly and i was using static latitude and longitude from the example the 37 and -122 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.