Skip to content

Printing Last Executed Mysql Query in CodeIgniter?

In codeIgniter We can get last executed MySQL Query With One of the CI’s Query Helper function called last_query(), you can use this as shown below

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

This function is incredibly helpful while debugging generated Queries by Active Records.

Last Query Function

  $this->db->last_query();

I hope you like this tutorial and please don’t forget to comment your suggestions and do share this with your friends.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments