• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
View query before being executed?


How can I dump the query that $this->db is going to execute so that I can review it?

So, for example, for this query, I'd like to see the SQL (even if I just var_dump it):

$data['query'] = $this->db->get('cm_contact');

thanks in advance

nevermind. found it.

According to the documentation, last_query() returns the sql for the last query that has already been executed. It pops the last query off the queries[] array from the CI_DB_Driver class and it looks like the query doesn't get added to the array until it's run.

There is a method _select_compile that lets you show the query before executing but as you can gather from the name it only works for the select statements.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.