I’m having trouble with some of the more complicated queries sent through PDO using prepared statements. While errorInfo() is useful in showing syntax errors, it doesn’t really show logic errors and what is actually part of the query.
Is there a way to echo out the query that PDO executed last? As in, the actual query sent to database? The class should store it somewhere right, because it does send it to database somewhere? Is there a method or some way of catching it?
Currently my debugging system echoes out only the query with ? in place of actual parameters, which is less useful if the error is in logic.
Thanks!
Did you try PDOStatement::debugDumpParams? It gives you detailed information about parameters.
From the manual: