aldrin151 Posted September 7, 2008 Share Posted September 7, 2008 Hi everyone...I've been trying to round of by FLOOR in mysql statement the value of AS distance below...does anyone know how to write the correct way...? Reason is that when I send a param of miles in a round number format I want it to match this value. $sSQL = "SELECT *, (ACOS((SIN(RADIANS(" .$lat."))*SIN(RADIANS(latitude))) + (COS(RADIANS(" .$lat."))*COS(RADIANS(latitude))*COS(RADIANS(longitude)-RADIANS(" .$lng. ")))) * ".$unit1.") AS distance FROM users WHERE (ACOS((SIN(RADIANS(" .$lat. "))*SIN(RADIANS(latitude))) + (COS(RADIANS(" .$lat. "))*COS(RADIANS(latitude))*COS(RADIANS(longitude)-RADIANS(" .$lng. ")))) * ".$unit1.") <= " .$miles. ""; Thanks Quote Link to comment Share on other sites More sharing options...
aldrin151 Posted September 7, 2008 Author Share Posted September 7, 2008 Funny I solved my own problem....this may help someone out there $sSQL = "SELECT *, FLOOR((ACOS((SIN(RADIANS(" .$lat."))*SIN(RADIANS(latitude))) + (COS(RADIANS(" .$lat."))*COS(RADIANS(latitude))*COS(RADIANS(longitude)-RADIANS(" .$lng. ")))) * ".$unit1.")) AS distance FROM users WHERE FLOOR((ACOS((SIN(RADIANS(" .$lat. "))*SIN(RADIANS(latitude))) + (COS(RADIANS(" .$lat. "))*COS(RADIANS(latitude))*COS(RADIANS(longitude)-RADIANS(" .$lng. ")))) * ".$unit1.")) <= " .$miles. ""; $sOrder = ""; 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.