Possible duplicate:
Prepared PDO reports
I am sure that the answer to this question is very simple, but I seem to be unable to find it.
I use PDO (PHP data objects) to run a query on a MySQL database and would find it useful to display the prepared query before executing it from the database.
Is there any way to do this? For instance:
$query = 'SELECT Id, Name, Comment FROM Users WHERE Id = :id';
$pdoStatement = $db->prepare($query);
$pdoStatement->bindValue(':id', $id);
$pdoStatement->execute();
Bryan source
share