Siddeshwar Vanga
Siddeshwar Vanga

Reputation: 20

Need to Know Which Query going to Execute in code igniter

I got some problem in code igniter . I just want to know which query going to execute in model. I knew about last query execution using $this->db->last_query();

Since, I doesn't want this there are multiple queries execution so, I am not able to identify exact query . so , i want to know which query will generate in code igniter before it could execute.

Upvotes: 0

Views: 56

Answers (3)

Ruprit
Ruprit

Reputation: 743

Add this line in your controller:

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

Doing this you can see all the queries executed at the bottom of your pages.

Upvotes: 1

Kamran
Kamran

Reputation: 2741

you can check all the queries by adding $this->output->enable_profiler(TRUE); in your controller constructor or in your model function. When you will run it will show all the queries on that page.

Upvotes: 0

Sadikhasan
Sadikhasan

Reputation: 18601

Try this

$str = $this->db->last_query();
echo $str; //// Produces: SELECT * FROM sometable.... 

Check Manual

Upvotes: 0

Related Questions