mysql - codeigniter left join without wrapping character -


i'm having trouble generating query in codeigniter. problem is

$this->db->select('user.*')     ->join('user_group', 'user.group_id between user_group.start_range , user_group.end_range', 'left'); 

this code generates following query:

select `user`.* (`user`) left join `user_group` on `user`.`group_id` `between` user_group.start_range , user_group.end_range 

here, mysql can not recognize between inside quote character, how can generate query without wrapping quote character. please, give me suggestion.

i'm using codeigniter 2.2.0

you need either override $_reserved_identifiers variable in ci_db_driver class following

var $_reserved_identifiers  = array('*', 'between'); // identifiers should not escaped 

(note im not sure if reduces security)

https://github.com/bcit-ci/codeigniter/blob/2.2-stable/system/database/db_driver.php#l67

the other option replicate between operator using >= , <=


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -