How to print SQL statement in codeigniter model

前端 未结 14 1921
迷失自我
迷失自我 2020-11-30 22:08

I have a sql statement in my model,

I then say

$query = $this->db->query($sql, array(fields, fields1);

if ($query) {
    return true:
} else {         


        
14条回答
  •  自闭症患者
    2020-11-30 22:40

    Neither last_query() or get_compiled_select() works for me, so a slight change of pedro's code works for me just fine. Do not include ->get() in your build, this must be before the ->get()

     echo $this->EE->db->_compile_select();
    

提交回复
热议问题