我正在尝试过滤我的表格结果并按 lon 和 lat 坐标对其进行排序,但是我正在使用的代码出现错误。这是代码,但我不确定我是否使用了正确的排序计算。谁能帮忙:
$keyword = //From Form Input
$lon = //From Form Input
$lat = //From Form Input
$filter = //From Form Input
$radius = 6371;
//$get_result_sql = "SELECT * FROM members WHERE type = '$filter' AND name LIKE '%$keyword%'";
$get_result_sql = "SELECT * FROM members WHERE type = '$filter' AND name LIKE '%$keyword%' ORDER BY acos(sin($lat) * sin(lat) + cos($lat) * cos(lat) * cos(lon - ($lon))) * $radius DESC";
$get_result_res = mysqli_query($con, $get_result_sql);
if(mysqli_affected_rows($con)!=0){ //and if atleast one record is found
while($result = mysqli_fetch_assoc($get_result_res)){//This line has the error