Possible Duplicate:
In PHP with PDO, how to check the final SQL parametrized query?
I am creating an in-memory SQLite database and attempting to run a query on it. I am preparing a SELECT
statement and trying to bind a value - but it isn't working:
<?php
$db = new PDO('sqlite::memory:');
$statement = $db->query('CREATE TABLE test ( id INT )');
$statement->execute();
$statement = $db->prepare('SELECT id FROM test WHERE id = ?');
$statement->execute(array('12'));
echo $statement->queryString;
?>
I expect the script to output 'SELECT id FROM test WHERE id = "12"'
but instead the script ignores the value I bound and outputs: 'SELECT id FROM test WHERE id = ?'
.
What am I doing wrong, and how can I bind a value?