Welcome Guest, Not a member yet? Register   Sign In
newbie active record question: show me the SQL!
#1

[eluser]andjules[/eluser]
I've implemented a search function, and built the query using a few of the active record commands. I'm getting results, but clearly not the right ones...
SO, I want to debug
BUT I can't find documentation on how to get CI to show me the final SQL used by active record!
#2

[eluser]ontguy[/eluser]
The application profiler will show the sql used. Just add $this->output->enable_profiler(TRUE); to a controller function; http://ellislab.com/codeigniter/user-gui...iling.html
#3

[eluser]Unknown[/eluser]
or ...

Code:
$this->db->last_query();

Returns the last query that was run (the query string, not the result). Example:
Code:
$str = $this->db->last_query();
Code:
echo $str;

// Produces: SELECT * FROM sometable....

ripped from the user_guide




Theme © iAndrew 2016 - Forum software by © MyBB