tags:

views:

234

answers:

2

Is there a way to retrieve the query that was used to generate a PDO Prepared statement object?

A: 

I don't think that's possible :(

Edit: Ops, never read that comment :P

AntonioCS
Sure it is possible ;)
DaNieL
+6  A: 

Try $statement->queryString.

Arkh
Bingo: http://www.php.net/manual/en/class.pdostatement.php#92046
DaNieL
Whenever I use this, it still shows the params as place-holders. Is there anyway to get the string with the params set? The way the DB gets it?
John Isaacks
You'd have to check your database logs. For MySQL, check this page : http://dev.mysql.com/doc/refman/5.0/en/query-log.html
Arkh