You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 5

SELECT cs.crimeid, l.locationid, l.lat, l.lng, l.location, ct.title AS crimetype, cy.crimemonth, cy.crimeyear FROM crime_s cs INNER JOIN location l ON (l.locationid = cs.locationid) INNER JOIN crimeyear cy ON (cy.ID = cs.crimeyearid) INNER JOIN crimetype ct ON (ct.typeid = cs.crimetypeid) WHERE MBRContains(GeomFromText('Polygon((53.794843283409 -1.4725647720739, 53.823756716591 -1.4725647720739, 53.823756716591 -1.4236152279261, 53.794843283409 -1.4236152279261, 53.794843283409 -1.4725647720739))'), l.pt) AND cs.crimeyearid=