I am learning PHP Pdo and I got a question and answer.
Assuming that the PDO connection is valid. the following code returns none because the prepared statement is invalid.
I want to know why/how the prepared statement is invalid.
$pdo = new PDO(...);
$sql = "SELECT :cols FROM names WHERE name = :name";
$stmt = $pdo->prepare($sql);
$stmt->bindValue(':cols', 'COUNT(id)');
$stmt->bindValue(':name', 'anna');
$stmt->execute();