Codeigniter database error using between clause |
[eluser]Andy78[/eluser]
I am getting a database syntax error from codeigniter and its generating this sql query. Code: SELECT `code`, `latitude`, `longitude` FROM (`postcodes`) WHERE `latitude` `BETWEEN 55`.`8616 AND 56`.`1508` AND `longitude` `BETWEEN '-3`.`9507' AND '-3`.`6131'` AND `code` LIKE 'FK%' error 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 '`BETWEEN 55`.`8616 AND 56`.`1508` AND `longitude` `BETWEEN -3`.`9507 AND -3`.`61' at line 3 The query itself works when done directly in sql : SELECT code, latitude, longitude FROM ( `postcodes` ) WHERE latitude BETWEEN 55.8616 AND 56.1508 AND longitude BETWEEN - 3.9507 AND - 3.6131 AND code LIKE 'FK%' LIMIT 0 , 30 But ci seems to be adding single quotes ariound the points in the long/lat values why? Ci code: Code: function get_zips_in_range($zip, $range, $sort=1, $include_base=true)
[eluser]insert_hilarity_here[/eluser]
There is a bug in CI 2.1.1 https://github.com/EllisLab/CodeIgniter/issues/1469 Revert to 2.1.0 is the best solution until 2.1.2 comes out
[eluser]Andy78[/eluser]
Ah FFS been struggling with this for hours as well lol
[eluser]insert_hilarity_here[/eluser]
fyi https://github.com/EllisLab/CodeIgniter/issues/1469 bug is fixed but its been released again as CI 2.1.1 In my tests Datamapper continues to works well. |
Welcome Guest, Not a member yet? Register Sign In |