CodeIgniter Forums
How to extract the query from db object - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How to extract the query from db object (/showthread.php?tid=35569)



How to extract the query from db object - El Forum - 11-03-2010

[eluser]fatman[/eluser]
Hi,
I'm building a conditions screen where the user can build sql via GUI.

After the user is done he will press on the test button and i'll build a query dynamically and

test it using
Code:
$this->db->query($query,$data)
.

I also want to save the actual query after it has been verified (with the actual values instead of the question marks), is there a way to get it?

Thanks.


How to extract the query from db object - El Forum - 11-03-2010

[eluser]Bart Mebane[/eluser]
Code:
$sql = $this->db->last_query();