[ACCEPTED]-Getting raw SQL Queries in CodeIgniter 1.7-codeigniter

Accepted answer
Score: 45

Before the query runs:

$this->db->_compile_select(); 

And after it has run:

$this->db->last_query();

0

Score: 10

Of course, I found it 2 minutes after posting, courtesy 1 of Phil Sturgeon.

echo $this->db->last_query();
Score: 8

Also, you can put the following in your 2 controller:

$this->output->enable_profiler(TRUE);

You'll get queries and a lot 1 more.

Score: 1

For anyone finding this old post and wondering 2 what this is in the latest v3 the function 1 is $this->db->get_compiled_select().

More Related questions