나는 PHP에서 실행해야하는 다음과 같은 쿼리를 가지고있다. 문제는 내가 메인 쿼리의 실행하기 전에 설정 쿼리가 필요합니다. 세트 쿼리php에서 mysql 쿼리 양식
SET @center = GeomFromText('POINT(33.3666667 35.1666667)');
SET @radius = 1;
SET @bbox = CONCAT('POLYGON((',
X(@center) - @radius, ' ', Y(@center) - @radius, ',',
X(@center) + @radius, ' ', Y(@center) - @radius, ',',
X(@center) + @radius, ' ', Y(@center) + @radius, ',',
X(@center) - @radius, ' ', Y(@center) + @radius, ',',
X(@center) - @radius, ' ', Y(@center) - @radius, '))'
);
하고 주요 질의는 어떻게 PHP에서 이것을 실행할 수
SELECT
users_profile.id,
GLength(LineString(users_profile.location,GeomFromText('POINT(33.3666667 35.1666667)'))) * 100 as distance
FROM
users_profile
WHERE
Intersects(users_profile.location, GeomFromText(@bbox))
AND (GLength(LineString(users_profile.location,GeomFromText('POINT(33.3666667 35.1666667)'))) * 100) < 10
ORDER BY distance
입니까? 나는 4 가지 다른 쿼리로 할 수도없고 1로 할 수도 없다.
나는 많은 것으로 생각했다 – mbouclas