On the production page of my Yii 1.1 project I set up the error handling to get a mail message if an error occurs.
I want to add the SQL to the message content, if the error is a database related error.
How can I assign the SQL statement, that caused the error, to a PHP variable?
I am not sure there is a way but you might want to see what PDO provides as Yii just abstracts that. If it is possible there it should be possible here in some way.
I used Yii1 many years ago and have no idea currently