newbie active record question: show me the SQL! |
[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!
[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
[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 |
Welcome Guest, Not a member yet? Register Sign In |