重複の可能性:
PDOプリペアドステートメント
これに対する答えは非常に単純だと思いますが、私はそれを見つけることができないようです。
私はPDO(PHPデータオブジェクト)を使用してMySQLデータベースに対してクエリを実行していますが、DBに対して実行される前に、準備されたクエリを表示すると便利です。
これを行う方法はありますか?例えば:
$query = 'SELECT Id, Name, Comment FROM Users WHERE Id = :id';
$pdoStatement = $db->prepare($query);
$pdoStatement->bindValue(':id', $id);
// How can I view the actual statement that will be executed, showing the real
// value that will be used in place of ':id'
$pdoStatement->execute();