Cómo imprimir la consulta MySQL de Codeigniter Consulter Builder
To display the query string:
print_r($this->db->last_query());
To display the query result:
print_r($query);
Ankur