RE: Spatial query for the Nearest location given alat and long?
Results
Ok, I think it is working.
Here what I got for future reference
Given a $latitude and $longitude point I query table_1 to find the closest/nearest location points.
SELECT id, name,
distance_sphere(GeomFromText('POINT('|| $longitude ||' '|| $latitude ||')'),
GeomFromText('POINT('|| table_1.longitude ||' '|| table_1.latitude ||')')) as dist
FROM table_1
WHERE active = 't'
ORDER BY dist LIMIT 5;
Thanks again for all the help