How to print SQL statement in codeigniter model

前端 未结 14 1931
迷失自我
迷失自我 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:52

    You can use this:

    $this->db->last_query();
    

    "Returns the last query that was run (the query string, not the result)."

    Reff: https://www.codeigniter.com/userguide3/database/helpers.html

提交回复
热议问题