Query failed: 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 16 query: SELECT r1.room_id ,r1.x-r2.x+4 as x ,r1.y-r2.y+4 as y ,r1.z-r2.z+4 as z ,r1.colour,r1.n,r1.ne,r1.e,r1.se,r1.s,r1.sw,r1.w,r1.nw,r1.u,r1.d ,r2.x as char_x ,r2.y as char_y FROM zangerland.rooms AS r1 LEFT JOIN zangerland.rooms AS r2 ON( r1.x BETWEEN r2.x-4 AND r2.x+4 AND r1.y BETWEEN r2.y-4 AND r2.y+4 AND r1.z=0 ) LEFT JOIN zangerland.characters AS c ON(r2.room_id=c.room_id) WHERE c.char_id=