I'm using PDO to develop an application with PostgreSQL.
The problem is that the binding functions as PDOStatement::bindValue and PDOStatement::bindParam aren't working at all.
I have the following code:
<?php
try{
$db = new PDO("pgsql:dbname=test;host=localhost", "user", "password");
$all = '*';
$sql = $db->prepare("SELECT :all FROM schema.table");
$sql->bindValue(':all', $all);
var_dump($sql->queryString);
var_dump($sql->execute());
}
catch(PDOException $e){
print $e->getMessage();
}
?>
I just cannot understand the reason $sql->queryString's value still is SELECT :all FROM schema.table, as it var_dump()'d here.
PDOStatement::bindParam does exactly the same thing.
Any tips?
EDIT: This query is for debugging purposes only! Please, don't care about the query itself but in the method that isn't binding.