I have asked this question on stack overflow, what i need help with is to retrieve the database entries that fit within a polygon, drawn with the Google maps api. The map is showing the correct lat/lon coordinates when the user draws the polygon, we just need some help with the query below that will allow us to retrieve the correct entries from our database that have lat/lon that fit within the selected polygon
Here is the code that is suppose to show the entries that fit in the polygon.
// $sql = "SELECT * FROM ig_property WHERE Contains(GeomFromText('POLYGON((".$coords."))'),GeomFromText(property_latitude,property_longitude)) = 1"; $coords = $_POST['polygons']; if(!empty($coords)) $Contains = "AND Contains(GeomFromText('POLYGON((".$coords."))'),GeomFromText(property_latitude,property_longitude))"; else $Contains = "";
Anyone able to help with this?