phpactiverecord - display generated query?

user1977661 picture user1977661 · Mar 26, 2013 · Viewed 7.1k times · Source

Using phpactiverecord from http://www.phpactiverecord.org/, is there any way to see the generated SQL query for debugging, other than viewing the database server's query log?

Answer

kaizenCoder picture kaizenCoder · Aug 28, 2013

Within your Model:

echo self::connection()->last_query;

Outside your Model:

YourModelName::connection()->last_query;