Weird backticks behaviour in Active Record in CodeIgniter 2.0.3

后端 未结 9 1599
迷失自我
迷失自我 2020-12-29 06:08

Previously my all queries were running fine in CI version 2.0 but when I upgraded to 2.0.3 some of my SELECT queries were broken.

CI is adding

9条回答
  •  不思量自难忘°
    2020-12-29 06:20

    Here's a trick that worked for me. Replace this line

    $this->db->join($this->_table_device, $fieldname1. " = ".  $fieldname2, 'LEFT');
    

    with this:

    $this->db->join($this->_table_device, $fieldname1. " IN(".  $fieldname2 .")", 'LEFT');
    

    this will prevent CI from escaping your field. It's not ideal but it's better than the alternatives.

提交回复
热议问题