If you want to see the last executed MySQL query in CodeIgniter, this tutorial will help you.
Following statement will display the last executed query. see
echo $this->db->last_query();
For example you have following query to get users:
$this->db->select('*')->from('tbl_users');
$this->db->order_by("ID", "desc");
$this->db->limit(0,5);
$query_result = $this->db->get();
echo $this->db->last_query();
You will see last executed query as below:
SELECT * FROM (`tbl_users`) ORDER BY `ID` desc LIMIT 0,5