Skip to content
Advertisement

How do I get the query builder to output its raw SQL query as a string?

Given the following code:

JavaScript

I want to get the raw SQL query string that the database query builder above will generate. In this example, it would be SELECT * FROM users.

How do I do this?

Advertisement

Answer

To output to the screen the last queries ran you can use this:

JavaScript

I believe the most recent queries will be at the bottom of the array.

You will have something like that:

JavaScript

(Thanks to Joshua’s comment below.)

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement