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.