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 Link to comment https://forums.phpfreaks.com/topic/123183-solved-floor-in-mysql-statement/ 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 = ""; Link to comment https://forums.phpfreaks.com/topic/123183-solved-floor-in-mysql-statement/#findComment-636201 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.