PHP ActiveRecord – Get Last Query

I recently had to do some work on an older site that used the PHP implementation of ActiveRecord. One of the issues I had was that the queries being ran weren’t produced the expected result. I found two commands to help with this an issue the last run query:

~

I recently had to do some work on an older site that used the PHP implementation of ActiveRecord. One of the issues I had was that the queries being ran weren’t produced the expected result. I found two commands to help with this an issue the last run query:

If you’re within a model, you can do:

echo self::connection()->last_query;

and if you’re outside your model, you can use:

echo model::connection()->last_query;

~

Comments