RE: How to print SQL statement in codeigniter model?

How to print SQL statement in codeigniter model?

dip Team Leader Asked on June 7, 2018 in CODEIGNITER.
Add Comment
1 Answers
$sqlstatement = $this->db->last_query();

OR

There is a new public method get_compiled_select that can print the query before running

echo $this->db->get_compiled_select(); // before $this->db->get();
Senior Developer Answered on November 12, 2018.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.