Echo query before execution and without execution in codeigniter Active Record

后端 未结 5 1701
后悔当初
后悔当初 2020-12-08 10:43

I am looking for a way to see generated string of the query but without executing it.

Note that the query hasn\'t been executed before. (I do not wa

5条回答
  •  星月不相逢
    2020-12-08 11:40

    You can use some public methods to get SQL queries

    Get a SELECT query

    $sql = $this->db->get_compiled_select();
    

    Get a INSERT query

    $sql = $this->db->get_compiled_insert();
    

    Get a UPDATE query

    $sql = $this->db->get_compiled_update();
    

    Get a DELETE query

    $sql = $this->db->get_compiled_delete();
    

提交回复
热议问题