View SQL query(s) executed on page load

Is there anyway to view the actual query(s) that are run when one of the pages loads? Is there some simple PHP code that could get dropped in? This would help to see if all the dynamic variables that get passed to the page actually make it to the SQL query.

I presume you mean the server connect actions using to query the database and retrieve data.

Yes you can see those, just open the browser dev tools, go to the network tab and see all the XHR requests there

If you want to see the actual queries - ie the SELECT statements etc. - you may be able to view these in the log files. Eg if you’re running MySQL locally, you can view all queries as they’re executed if query logging is enabled.

To see the results of the query, as George says go to your developer tools in the browser, click on the network tab. When you reload your browser, you can see your requests. Click on parameters to see any post variables you have, then click on response to see your returned JSON.

For testing purpose, you can set test param to true as written here:

Then, in the Network tab of Chrome’s dev tools, you will see the complete query with parameters in the response of edited server connect.

As of version 1.9.0 there is a debug option available for the query builder in the UI (server connect panel) so you can enable it and run the server action in the browser.
There you can see the query and it’s parameters.

2 Likes