for example, i want to convert this;
$this->db->get('table');
to this;
'SELECT * FROM table'
is there any function for this? i searched on the user guide of CI but didnt find any solution.
for example, i want to convert this;
$this->db->get('table');
to this;
'SELECT * FROM table'
is there any function for this? i searched on the user guide of CI but didnt find any solution.
Try
echo $this->db->last_query();
after you run your Active Record Query and it'll spit out the raw SQL it ran for you. I use it often.
You can also use $this->db->_compile_select()
, difference between _compile_select() and last_query() is that _compile_select() gives the query string generated even if you dont run the query agaisnt the database.