codeigniter print last sql query

$this->db->last_query(); This line of code is used to retrieve the last executed SQL query in CodeIgniter. It accesses the database library instance and calls the last_query() method to obtain the SQL query that was most recently executed. This can be useful for debugging and troubleshooting database-related issues in your CodeIgniter application.