CodeIgniter Forums

Full Version: Escaping query
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

I try this query with ar
$this->db->having('distance <=',100 * 1.609344,FALSE);
        $this->db->select(" j.*, group_concat(DISTINCT as employment_types,"
                            ." group_concat(DISTINCT ) as categories,"
                            ." distance(j.location_latitude, j.location_longitude, ".$latitude.", ".$longitude.") as distance"
        )->from('job j')->limit(1);
        $this->db->join('job_employment_type_relation jetr','jetr.job_id =');
        $this->db->join('employment_type et','');
        $this->db->join('job_category_relation jcr','jcr.job_id =');
        $this->db->join('category c','');

and i got
SELECT `j`.*, group_concat(DISTINCT as employment_types, group_concat(DISTINCT ) as categories, distance(j.location_latitude, `j`.`location_longitude`, `0`, `0)` as distance FROM (`job` j) JOIN `job_employment_type_relation` jetr ON `jetr`.`job_id` = `j`.`id` JOIN `employment_type` et ON `et`.`id`=`jetr`.`employment_type_id` JOIN `job_category_relation` jcr ON `jcr`.`job_id` = `j`.`id` JOIN `category` c ON `c`.`id`=`jcr`.`category_id` WHERE `j`.`status` = 'open' GROUP BY `j`.`id` HAVING distance <= 160.9344 LIMIT 1

see : distance(j.location_latitude, `j`.`location_longitude`, `0`, `0)`

but wen we add space before ) it parsed well